|
 |
|
ส่ง pass ใหม่ที่สร้าง เข้า อีเมล์ ผู้ใช้ ด้วยไม่ไปอยู่ที่อีเมล์ ขยะไหม ครับ |
|
 |
|
|
 |
 |
|
ถ้าเปลี่ยนเป็นแบบนี้ละได้ไหม พอดีทำใน appser
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #66CCFF;
}
.style1 {color: #4DA0C6}
-->
</style></head>
<script>
function window_close()
{
window.close()
window.opener.location.reload();
}
</script>
<body>
<p>
<?
include"../config.in.php";
$Student_Code=$_POST['Student_Code'];
$Student_Email=$_POST['Student_Email'];
$sql = "select Student_Code from student where Student_Email='$Student_Email' AND Student_Code='$Student_Code'";
$rs = mysql_query($sql);
$numrow = mysql_num_rows($rs);
if ($numrow==0){
die("<script>
alert('ไม่พบอีเมล์นี้ในระบบ');
history.back();
</script>");
}else{
$gen=8;
$char_passwd = "1234567890abcdefghijklmnopqrstuvwxyz";
$password = "";
while(strlen($password)<$gen) {
$password .= $char_passwd[rand()%strlen($char_passwd)];
}
$strTo = "$Student_Email";
$strSubject = "PASSWoRD NEW by Project System";
$strHeader = "From: webmaster <[email protected]>";
$strMessage = "รหัสใหม่ คือ $password";
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo ("<script>
alert('ส่งอีเมล์เรียบร้อยแล้ว');
history.back();
</script>");
}
else
{
echo ("<script>
alert('error\กรุณาติดต่อผู้ดูแล');
history.back();
</script>");
}
$password=md5($password);
$sql = "update student set Student_Pass='$password' where Student_Code='$Student_Code'";
$rs = mysql_query($sql) or die("Err : $sql");
}
?>
<br />
</p>
<p>
<input type="button" class="style1" title="close" onClick="window_close();" value=" ปิด ">
</p>
</body>
</html>
$strTo = "$Student_Email";
$strSubject = "PASSWoRD NEW by Project System";
$strHeader = "From: webmaster <[email protected]>";
$strMessage = "รหัสใหม่ คือ $password";
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo ("<script>
alert('ส่งอีเมล์เรียบร้อยแล้ว');
history.back();
</script>");
}
else
{
echo ("<script>
alert('error\กรุณาติดต่อผู้ดูแล');
history.back();
</script>");
}
|
ประวัติการแก้ไข 2011-02-07 17:56:52
 |
 |
 |
 |
Date :
2011-02-07 17:56:21 |
By :
ckcr |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แต่ปกติแล้วเข้าไปอยู่ใน Junk เป็นเรื่องปกติน่ะครับ ลองอ่านบทความนี้น่ะครับ
Go to : PHP Sending Email / Send Mail
Go to : วิธีส่งเมลล์ ไป hotmail ขอวิธีเขียนสคริปส่งเมลล์ ไปที่เมลล์ของ hotmail แล้วไปอยู่ที่กล่องจดหมาย ไม่อยู่ใน junk
Code (PHP)
<?
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();
?>
Go to : PHP Forgot Lost Password and Sending Password to Mail ทำ Form ลืมรหัสผ่าน ด้วย PHP กับ MySQL
|
 |
 |
 |
 |
Date :
2011-02-07 22:32:34 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|