01.
<?
02.
mysql_connect(
"localhost"
,
"kleawwhai_stu"
,
"******"
);
03.
mysql_select_db(
"kleawwhai_stu"
);
04.
$strSQL
=
"SELECT * FROM admin WHERE Username = '"
.trim(
$_POST
['txtUsername
'])."'
05.
OR email =
'".trim($_POST['
txtEmail
'])."'
";
06.
$objQuery
= mysql_query(
$strSQL
);
07.
$objResult
= mysql_fetch_array(
$objQuery
);
08.
if
(!
$objResult
)
09.
{
10.
echo
"ไม่พบ Username หรือ E-mail ในระบบ!"
;
11.
}
12.
else
13.
{
14.
echo
"รหัสผ่านได้ถูกส่งไปทางอีเมลล์เรียบร้อยแล้ว.<br>Send to mail : "
.
$objResult
[
"email"
];
15.
16.
$strTo
=
$objResult
[
"txtEmail"
];
17.
$strSubject
=
"Your Account information username and password."
;
18.
$strHeader
=
"Content-type: text/html; charset=windows-874\n"
;
19.
$strHeader
.=
"From: thailandsupertop@hotmail.com\nReply-To: thailandsupertop@hotmail.com"
;
20.
$strMessage
=
""
;
21.
$strMessage
.=
"Welcome : "
.
$objResult
[
"Username"
].
"<br>"
;
22.
$strMessage
.=
"Username : "
.
$objResult
[
"Username"
].
"<br>"
;
23.
$strMessage
.=
"Password : "
.
$objResult
[
"Password"
].
"<br>"
;
24.
$strMessage
.=
"=================================<br>"
;
25.
$strMessage
.=
"ลืมรหัสผ่าน<br>"
;
26.
$flgSend
= mail(
$strTo
,
$strSubject
,
$strMessage
,
$strHeader
);
27.
28.
}
29.
mysql_close();
30.
?>