else
{
##User isn't registering, check verify code and change activation code to null, status to activated on success
mysql_connect("localhost", sssssss, passs) or die(mysql_error());
mysql_select_db("sssss") or die(mysql_error());
$queryString = $_SERVER['QUERY_STRING'];
$query = "SELECT * FROM users";
$result = mysql_query($query) or die(mysql_error());
/*
Your script is always falling into this WHILE statement, which is what causes your page to output "Congrats!", etc. at the top of the registration page. Also, your script is outputting this text before the <head> section of your HTML. To get it to output in the correct place on the page, you should store that statement in a variable, then echo your variable somewhere down your page. You can add PHP scripts to pretty much anywhere in your HTML and so doing this will not be a problem.
More importantly, you need to examine why your script is *always* going into this WHILE statement. I think it is always going into this WHILE statement because of line 133. You are selecting all records from your database. On line 135, you're checking that variable for data to ensure the query was successful. Since the variable has data in it, then your script falls into the WHILE statement and echos all the usernames stored in it from the SELECT statement. It seems to me that you need to improve your SELECT statement and that should correct the problem.
*/
while($row = mysql_fetch_array($result))
{
/*
Changed double quotes to single quotes on the $row variables in the IF statement
*/
if ($queryString == $row['activationkey'])
{
$congrats = "Congrats! " . $row['username'] . " is a member of socialemo.com.";
$sql="UPDATE users SET activationkey = '', status='activated' WHERE (id = ".$row['id'].")";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
}
}
}
?>
obviously ive got some help but i dont know how to change the while statement thing. my page is socialemo.com/register.php and there is a problem.
everytime i register a user it ALWAYSdisplays the congrats part... always!!! and it should only when the user clicks in the activation link in the email that gets sent by the script. which makes no sense to me why it shows up everytime because the activation email is supposed to hav a activation key at the end right.
and it makes no sense cause it says if the activation key matches then it shows the "congrats part" but the activation key gets deleted i dont understand how it can still show the congrats after it doesnt match help please?