Error in my activation.php script
Posted: Sun Jun 21, 2009 10:26 pm
Hi,
I am having a tough time with this activation code of mine. My registration script sends email with the activation link
here is an example of the activation link:
Here is my activation script:
Here is the problem:
Every time I click on the mail, it gives me "Could not get duplicates" message. So, i guessed some how i am not able to get the values from the url. I did a "print" statement of the url and it prints correctly. Can some one please tell me where I am going wrong?
Do you think i need to clear blank spaces or purify the "email" and "code" before using it MySQL statement?
Any help will be appreciated.
Thank you
I am having a tough time with this activation code of mine. My registration script sends email with the activation link
here is an example of the activation link:
Code: Select all
http://www.domain.com/fun/account/activ ... e=65464049Code: Select all
<?php
// Read url
$email = $_GET['email'];
$code = $_GET['code'];
// Open database connection
include ("dbConnect.php");
// Prepare statement
$sql = "SELECT * FROM userdata WHERE email='$email' AND activationpassword='$code'";
// Execute statement
$result = mysql_query($mysql) or die("[b]Could not get duplicates[/b]");
// Get the number of rows
$count=mysql_num_rows($result);
if($count == 1){
/*
* Authenticated URL, validate user
*/
// Prepare mysql statement
$sql = "UPDATE userdata set validation='yes' WHERE email='$email'";
mysql_query($sql) or die("Sorry, there was an error. Your account could not be validated");
// Create cookies and store data
setcookie( "oneword", $email, time()+3600, "/", "domain.com" );
// Check if cookie is created successfully
if (isset($_COOKIE["oneword"])){
header("Location:http://www.domain.com/fun/index?ID=new_account");
exit();
}else{
print "Your account has been activated. Please enable cookie in your browser to play ONEWORD.";
}
}
?>Every time I click on the mail, it gives me "Could not get duplicates" message. So, i guessed some how i am not able to get the values from the url. I did a "print" statement of the url and it prints correctly. Can some one please tell me where I am going wrong?
Do you think i need to clear blank spaces or purify the "email" and "code" before using it MySQL statement?
Any help will be appreciated.
Thank you