Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

simple trouble on account verification script

$
0
0

Hey guys, I am having a bit of trouble on my new registered account verification script.

It gets the code from the email sent after you register to activate your account to a 'level1' user. It uses a randomly generated code to do it and a GET function.

Using the url with the variable: verify.php?id=codingforums

Here is my code:

<?php
$queryString = $_GET['id'];
$query  = "SELECT * FROM users LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
    if ($queryString == $row["activationkey"]) {
        echo "Congratulations! You have activated your account. You may login your account.";
        $sql = "UPDATE users SET activationkey = '', level='1' WHERE (user_id = $row[user_id])";
        if (!mysql_query($sql)) {
            die('Error: ' . mysql_error());
        }
    } else {
        echo "The account containing the verification code you requested has already been activated, or the validation code is invalid";
    }
}
?>


But I keep using the code with an account thats not verified. and it keeps returning 'The account containing the verification code you requested has already been activated, or the validation code is invalid'

here is how my DB looks
TD5oKG5.png

Anyone notice the problem at all?

Viewing all articles
Browse latest Browse all 13200

Trending Articles