MY problem is not the email successfully sending, it is the confirmation page on my website. The email has already sent to the user, but when they click the link to activate their password it then brings them to a confirmation page, and it supposed to confirm the activation, and register them, but it is not doing anything at all. IT just shows up a blank page, and i even checked the databases, and nothing is changed. I would like any help, and i also have the code below for it. Any help would be great.
<?php
include('sqlconfig.php');
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
/* Confirmation Code */
$passkey=$_GET['passkey'];
$tbl_name1="temp_users";
/*retrieve data */
$sql1="SELECT * FROM temp_users WHERE confirm='$passkey'";
$result1=mysql_query($sql1);
if($result1){
$count=mysql_num_rows($result1);
/*Fetch The data From the table */
if($count==1){
$rows=mysql_fetch_array($result1);
$Email=$rows['email'];
$First_Name=$rows['FirstN'];
$Last_name=$rows['LastN'];
$password=$rows['password'];
$phone=$rows['phone'];
$tbl_name2="users";
/*Insert data into new users table */
$sql2="INSERT INTO $tbl_name2(First Name, Last Name, Email, Password, phone)VALUES('$First_Name', '$Last_name', '$Email', '$password', '$phone')";
$result2=mysql_query($sql2);
}
/*If passkey is not found*/
else {
echo "Wrong Confirmation code";
}
/*If activation successful, show, and delete old data from temp table*/
if($result2){
echo "Your account has been activated";
// Delete information of this user from table "temp_members_db" that has this passkey
$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
$result3=mysql_query($sql3);
}
}
?>
try this.
if($passkey == NULL) //check for passkey whether it is null or not, this might be the reason of blank screen
{
echo “invalid action on page”; // some error message
}
else
{
$flag = FALSE; // initiate somewhere at the begining of script
}
first the code will check whether there is any result coming from the query, if yes then it fetches data and insert into the table2.
a new variable flag is introduced to check whether query2 is executed, if so then query 3 is executed.
Edit : first check whether the passkey coming contains some value or not, if no it shows error, else rest of code execute