login email activation problem
Posted: Tue Aug 21, 2012 6:02 am
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:
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.
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:
// 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; }and here is the if statement:
if (empty($errors) && is_active($_POST['usesrname']) === false) { $errors[] = 'Check your email for the activation link.'; }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.