Jump to content

Non email activated user warning


bytesize

Recommended Posts

I would like to include: 'You have not activated your account, please check your email' message if the user is registered but not activated. The database field 'active' is set to '0'. When the user activates their account from an e-mail, the 'active' field is set to '1'. This code works but I can't get it to display the not activated message which is not included because I didn't want to create confusion.

<?php	
function login($username, $password)
{
db_connect_posts();

$query = sprintf("SELECT * FROM users
WHERE 
 user_email = '%s' AND
 user_pwd = '%s' AND 
 active = '1'"
 , mysql_real_escape_string($username),
	 md5($password));

$result = mysql_query($query);

$number_of_posts = mysql_num_rows($result);
if($number_of_posts == 0)
{
return false;
}

$row = mysql_fetch_array($result);

$_SESSION['user'] = $row;

return true;							
}
?>

Login switch

<?php
case "login_user":
if(login($params['user']['user_email'], $params['user']['user_pwd']))
{
	redirect_to('posts');
}
else
{
	flash_warning('Username or password is invalid');
	$route['view'] = 'login';
}
break;
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.