Hey everyone,
So this is sort of complicated but I will try to make things as clear as possible. I have a registration page that processes all of the information and sends an automated email to the user with their username and password and a link to activate the account and includes the login page. However when user's click the link the message says "Your account has been activated" but when I log in using the log in credentials the email gives me, It gives me the message "Your account could not be activated!" How is this happening?
(in the activate.php, I have the variable being passed as "$doublecheck" which equals the query to UPDATE the table in my database and that variable is the integer of "1". However that integer is changed to "0" when passed through the if/else statement
checking if $doublecheck is == 0 or if $doublecheck > 0 ..)
<?php
session_start();
/* Account activation script */
// Get database connection
include 'membership_db.php';
// Create variables from URL.
$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];
$sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'");
$sql_doublecheck = mysql_query("SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'") or die (mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck);
echo $doublecheck;
if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login below!<br />";
include 'logIn.php';
}
?>