Jump to content

Help with email validation please...


kam1313

Recommended Posts

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

 

 

Link to comment
Share on other sites

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);

}

 

}

 

?>

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Read through all the answers and try each one. If you don't, i highly doubt anyone is going to repeat themselves :P - 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-

Link to comment
Share on other sites

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.