我的問題不是電子郵件成功發送,它是我的網站上的確認頁面。電子郵件已經發送給用戶,但是當他們點擊鏈接激活密碼時,它會將它們帶到一個確認頁面,它應該確認激活並註冊它們,但它根本沒有做任何事情。 IT只是顯示一個空白頁面,我甚至檢查了數據庫,沒有任何改變。我想要任何幫助,我也有下面的代碼。任何幫助都會很棒。電子郵件確認使用php
<?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);
}
}
?>
你是**敞開** SQL注入攻擊,和你**會如果你還沒有被黑客攻擊**。學習如何使用PDO或類似的準備好的查詢來完全避免這個問題。 – Brad
空白頁不會說太多;添加'ini_set('display_errors','On'); error_reporting(-1);'在腳本的頂部並重試。 –