I'm using the following script in this user management system I'm working on.
So far, I have it so the user can create an account, is sent an email with an encrypted password and asked to follow a link to activate.php which SHOULD update their account to activated and give them the ability to log in.
However, no matter what I do I always get 'Your account could not be activated . . .'
I've stared and stared at the code and I can't see any problems with it. Perhaps you guys will have better luck with it?
<?
// Get database connection
include 'db.php';
// Create variables from URL.
$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];
$sql = mysql_query("UPDATE profiles SET activated='1' WHERE userid='$userid' AND password='$code'")or die(mysql_error());
$sql_doublecheck = mysql_query("SELECT * FROM profiles WHERE userid='$userid' AND password='$code' AND activated='1'")or die(mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck)or die(mysql_error());
if($doublecheck == 0){
echo "Your account could not be activated, please contact [email]webmistress@hollowdreams.net[/email];
} elseif ($doublecheck > 0) {
echo "Your account has been activated. You may login below:<br />";
include 'login_form.html';
}
?>
Thanks in advance for your help.
Roses