ส่งอีเมลให้กับผู้สมัครสมาชิกในกรณีที่ลืมรหัสผ่าน forgot password
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorials</title>
</head>
<body>
<?
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."'
OR Email = '".trim($_POST['txtEmail'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not Found Username or Email!";
}
else
{
echo "Your password send successful.<br>Send to mail : ".$objResult["Email"];
$strTo = $objResult["txtEmail"];
$strSubject = "Your Account information username and password.";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected] \nReply-To: [email protected] ";
$strMessage = "";
$strMessage .= "Welcome : ".$objResult["Name"]."<br>";
$strMessage .= "Username : ".$objResult["Username"]."<br>";
$strMessage .= "Password : ".$objResult["Password"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader);
}
mysql_close();
?>
</body>
</html>
Go to : PHP Forgot Lost Password and Sending Password to Mail ทำ Form ลืมรหัสผ่าน ด้วย PHP กับ MySQL
Date :
2011-12-01 17:38:37
By :
webmaster
ลองบนโฮสจริง ๆ ดูครับ หรือไม่ก็ติดตั้ง SMTP ครับ
Date :
2011-12-02 10:49:24
By :
webmaster
Load balance : Server 03