login email activation problem

Post here is you are having problems with any of the tutorials.
Post Reply
keystone
Posts: 10
Joined: Mon Aug 20, 2012 10:00 pm

login email activation problem

Post by keystone »

Some reason it still allows login if not activated.

The email is being sent and the activation is being put into the table and if activated is being deleted. So the if statement to check if the activation is still in the table is not working... I've tried different things and I've tried error handling but only get "resource #5"

here is my is_active:

[syntax=php]// checks if the given user account is active
function is_active($user)

{
$user= mysql_real_escape_string($user);

$sql = "SELECT
COUNT(`users_activation`.`user_id`)
FROM `users`
INNER JOIN `users_activation`
ON `users`.`id` = `users_activation`.`user_id`
WHERE `users`.`user_name` ='{$user}'";

$result = mysql_query($sql);

return (mysql_result($result, 0) == '0') ? true : false;

}[/syntax]

and here is the if statement:

[syntax=php]if (empty($errors) && is_active($_POST['usesrname']) === false)

{
$errors[] = 'Check your email for the activation link.';
}[/syntax]

my thought is that I have the wrong variables from my table but I've played with this for a few hours now with no luck...

SELECT
COUNT(`table2`.`table2_user_id_field`)
FROM `table1`
INNER JOIN `table2`
ON `table1`.`table1_user_id_field` = `table2`.`table2_user_id_field`
WHERE `table1`.`table1_user_name_field` ='{$user}'";

it looks like table1_user_id_field is equal to table2_user_id_field

I think this is enough of the code. Thanks in advance.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: login email activation problem

Post by Temor »

[syntax=php]is_active($_POST['usesrname']) === false)[/syntax]

You have a typo here.
keystone
Posts: 10
Joined: Mon Aug 20, 2012 10:00 pm

Re: login email activation problem

Post by keystone »

Oh my goodness!! Just a silly misspelling lol I guess I should take breaks more often : ) thanks soo much
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: login email activation problem

Post by Temor »

No worries :P
Post Reply