01.
<html>
02.
<head>
03.
<title>Test</title>
04.
</head>
05.
<body>
06.
<form name=
"form1"
method=
"post"
action=
"SendPassword.php"
>
07.
Forgot your password? (Input Username
or
Email)<br><br>
08.
<table border=
"1"
style=
"width: 300px"
>
09.
<tbody>
10.
<tr>
11.
<td> Username</td>
12.
<td>
13.
<input name=
"username"
type=
"text"
id=
"username"
>
14.
</td>
15.
</tr>
16.
<tr>
17.
<td> Email</td>
18.
<td><input name=
"email"
type=
"text"
id=
"email"
>
19.
</td>
20.
</tr>
21.
</tbody>
22.
</table>
23.
<br>
24.
<input type=
"submit"
name=
"btnSubmit"
value=
"Send Password"
>
25.
</form>
26.
</body>
27.
</html>
28.
29.
30.
<strong>SendPassword.php</strong>
31.
[php]<html>
32.
<head>
33.
<title>Test</title>
34.
</head>
35.
<body>
36.
<?php
37.
mysql_connect(
"localhost"
,
"root"
,
"1234"
);
38.
mysql_select_db(
"research"
);
39.
$strSQL
=
"SELECT * FROM coordinator WHERE username = '"
.trim(
$_POST
['username
'])."'
40.
OR Email =
'".trim($_POST['
email
'])."'
";
41.
$objQuery
= mysql_query(
$strSQL
);
42.
$objResult
= mysql_fetch_array(
$objQuery
);
43.
if
(!
$objResult
)
44.
{
45.
echo
"Not Found Username or Email!"
;
46.
}
47.
else
48.
{
49.
echo
"Your password send successful.<br>Send to mail : "
.
$objResult
[
"email"
];
50.
51.
$strTo
=
$objResult
[
"email"
];
52.
$strSubject
=
"Your Account information username and password."
;
53.
$strHeader
=
"Content-type: text/html; charset=windows-874\n"
;
54.
$strHeader
.=
"From: webmaster@thaicreate.com\nReply-To: webmaster@thaicreate.com"
;
55.
$strMessage
=
""
;
56.
$strMessage
.=
"Welcome : "
.
$objResult
[
"name"
].
"<br>"
;
57.
$strMessage
.=
"Username : "
.
$objResult
[
"username"
].
"<br>"
;
58.
$strMessage
.=
"Password : "
.
$objResult
[
"password"
].
"<br>"
;
59.
$strMessage
.=
"=================================<br>"
;
60.
$strMessage
.=
"ThaiCreate.Com<br>"
;
61.
$flgSend
= @mail(
$strTo
,
$strSubject
,
$strMessage
,
$strHeader
);
62.
63.
}
64.
mysql_close();
65.
?>
66.
</body>
67.
</html>