Jump to content

Recommended Posts

This is the email verification script im using..

 

//email verify
$activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
$sql="INSERT INTO account_info (activation_key, status) VALUES ('$activationKey', 'verify')";

if (!mysql_query($sql)){

exit('Error: ' . mysql_error());
}

else {



//Send activation Email

$to = $_POST['email'];
$subject = "NarutoRPG.com Registration";
$message = "Welcome to our website! You, or someone using your email address, has completed registration at narutoRPG.com. You can complete registration by clicking the following link:\rhttp://www.arzania.com/verify.php?$activationKey\r\r If this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ narutoRPG.com Team";
$headers = 'From: ashyiscool2@gmail.com' . "\r\n" .
'Reply-To: ashyiscool2@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

//User isn't registering, check verify code and change activation code to null, status to activated on success

$queryString = $_SERVER['QUERY_STRING'];
$query = "SELECT * FROM account_info";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if ($queryString == $row["activation_key"]){
echo "Congratulations!" . " " . $row["username"] . " is now the proud new owner of a NarutoRPG.com account. Login to begin to play.";
$sql="UPDATE account_info SET activation_key = '', status='activated' WHERE (id = $row[id])";
if (!mysql_query($sql))

{

        die('Error: ' . mysql_error());

  }

    }

  }
}
}



include "footer.php";
?>

 

For some reason, when the person is registered it shows everyones name who registered, for example..

 

You've been successfully registered!Congratulations! tonyhh is now the proud new owner of a NarutoRPG.com account. Login to begin to play.Congratulations! tonyh is now the proud new owner of a NarutoRPG.com account. Login to begin to play.Congratulations! tony is now the proud new owner of a NarutoRPG.com account. Login to begin to play.etc...etc..

 

How can you make it only repeat the users name who registered, not everyone?

Link to comment
https://forums.phpfreaks.com/topic/215260-problem-with-a-while-loop-maybe/
Share on other sites

$query = "SELECT * FROM account_info";

 

you are selecting everyone from account_info

 

try:

 

$query = "SELECT * FROM account_info WHERE username = '".$_POST['username']."'";

 

that will make sure you are only selecting the user who registered by pulling what they added in the username field

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.