kam1313 Posted December 21, 2009 Share Posted December 21, 2009 Hi, Please could you help. I have a register.php login page where users register, the details are then logged into a temporary database, the user receives an email to verify their email address and then they complete the captha code and their details move to the permanent database. The problem I'm having is the email validation: //SELECT * FROM $tbl_name WHERE Code = '$passkey'" $sql="SELECT * FROM $tbl_name WHERE Code = '$passkey'"; $result=mysql_query($sql); if($result){ $count=mysql_num_rows($result); if($count==1){ $rows=mysql_fetch_array($result); $LName=$rows['LName']; $FName=$rows['FName']; $UserName=$rows['UserName']; $Password=$rows['Password']; The user receives the email and when they try to validate the information the message "wrong confirmation code" appears. Please help as I've checked this several times and its driving me nuts. Thanks Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 21, 2009 Share Posted December 21, 2009 it is not with the email validation as i guess it is with the confirmation code(captcha). just paste the entire code, then we might help u out use the code tags Quote Link to comment Share on other sites More sharing options...
kam1313 Posted December 21, 2009 Author Share Posted December 21, 2009 Thanks for the reply. Here's all the code: <?php //Confirm email $host = "************"; $username = "************; //connection to db $password = ********; $db_name = "*********"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $passkey=$_GET['Code']; $tbl_name = "Temp"; //SELECT * FROM $tbl_name WHERE Code = '$passkey'" $sql="SELECT * FROM $tbl_name WHERE Code = '$passkey'"; $result=mysql_query($sql); if($result){ $count=mysql_num_rows($result); if($count==1){ $rows=mysql_fetch_array($result); $LName=$rows['LName']; $FName=$rows['FName']; $UserName=$rows['UserName']; $Password=$rows['Password']; $Email=$rows['Email']; $Code=$rows['Code']; $tbl_name1="Dealers"; $sql1="INSERT INTO $tbl_name1(LName, FName, UserName, Password, Email, Code)VALUES('$LName', '$FName', '$UserName', '$Password', '$Email', '$Code')"; $result1=mysql_query($sql1); } else { echo "Wrong Confirmation code"; } if($result1){ echo "Your account has been activated"; $sql3="DELETE FROM $tbl_name WHERE Code ='$passkey'"; $result2=mysql_query($sql3); } } ?> Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 21, 2009 Share Posted December 21, 2009 what is this $passkey Quote Link to comment Share on other sites More sharing options...
kam1313 Posted December 21, 2009 Author Share Posted December 21, 2009 Hi, In the temporary database there is a field called 'code' and it takes this information and stores it as a variable called passkey. Thanks Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 21, 2009 Share Posted December 21, 2009 so if i understood correctly is this the captcha code u are using? Quote Link to comment Share on other sites More sharing options...
cags Posted December 21, 2009 Share Posted December 21, 2009 Can we see an example of a link the user will receive in their e-mail? Have you tried echo'ing $passkey before running the query to make sure it has the right value? My best guess given the limited information available is your link contains page.php?code=12345 not page.php?Code=12345. Quote Link to comment Share on other sites More sharing options...
kam1313 Posted December 21, 2009 Author Share Posted December 21, 2009 Hi We haven't used captcha yet. the passkey the automatic key generator for email confirmation. Cheers Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted December 21, 2009 Share Posted December 21, 2009 Yeah we need alittle more info than that . Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 21, 2009 Share Posted December 21, 2009 check in ur tables whether u have duplicate pass key values. as ur checking the count==1 i think there might be a chance of duplicate values. Quote Link to comment Share on other sites More sharing options...
kam1313 Posted December 21, 2009 Author Share Posted December 21, 2009 Hi, I have checked the tables and the columns in the temporary database are: - last name - first name - username - email - code (passcode) Thanks Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted December 21, 2009 Share Posted December 21, 2009 Read through all the answers and try each one. If you don't, i highly doubt anyone is going to repeat themselves - in which case you may nerver solve the problem. Can we see an example of a link the user will receive in their e-mail? Have you tried echo'ing $passkey before running the query to make sure it has the right value? My best guess given the limited information available is your link contains page.php?code=12345 not page.php?Code=12345. check in ur tables whether u have duplicate pass key values. as ur checking the count==1 i think there might be a chance of duplicate values. -CB- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.