1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<?php include("phpconfig.php");?> <?php $_POST['forgotemail']=trim($_POST['forgotemail']); if($_POST['forgotemail']){ $query="SELECT name_sname, password FROM tbl_member WHERE email= '".$_POST['forgotemail']."' AND registerType='1' "; //echo $query; $result=mysql_query($query); $data=mysql_fetch_assoc($result); if($data['password']!=''){ require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.bj.co.th"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "mailsender@bj.co.th"; // SMTP username $mail->Password = "12345678"; // SMTP password $mail->From = "bjcompany@bj.co.th"; $mail->FromName = "benjabhorn group"; $mail->AddAddress($_POST['forgotemail']); $mail->AddReplyTo("bjcompany@bj.co.th", "benjabhorn group"); $mail->WordWrap = 200; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = " forgot password www.bj.co.th/benjabhorn_group/"; $mail->Body="สวัสดีค่ะ คุณ ".$data['name_sname'] ."<br> username : ".$_POST['forgotemail'] ."<br> password : ".$data['password'] ." <br>ทีมงานบริหารเว็บไซต์ <br>" ."<a href='http://www.bj.co.th/benjabhorn_group/'>benjabhorn_group</a>"; if(!$mail->Send()) { print("".$mail->ErorInfo); }else { ?> <script language="javascript"> alert('รหัสผ่านของท่านจะส่งไปยังอีเมล์ <?php echo $_POST['forgotemail']?>'); window.location.href='index.php'; </script> <!-- print("ส่งเมล์ถึงผุู้รับแล้วครับ"); --> <!--print $textMessage; --> <?php } }else{ ?> <script language="javascript"> alert('ไม่มี อีเมล์ <?php echo $_POST['forgotemail']?> ในระบบ กรุณาลองใหม่'); window.location.href='forgotpass.php'; </script> <?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"> /*this is what we want the div to look like when it IS showing*/ div.centered{ display:block; /*set the div in the center of the screen*/ position:absolute; top:30%; left:35%; width:450px; background:#F0F0F0; } .class_box_shadow{ width: 450px; min-width: 200px; min-height: 100px; margin: auto; background: #ccc; border: 5px solid white; position:relative; box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.71); -moz-box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.71); -webkit-box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.71); }
</style> <link href="style.css" rel="stylesheet" type="text/css" /> </head>
<body> <div class="centered" align="center"> <div class="class_box_shadow"><br /> <form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <p>กรุณาใส่อีเมล์ <input name="forgotemail" type="text" /> <input name="" type="submit" value="ขอรับรหัสผ่าน" /></p> </form> </div> </div> </div>
</body> </html>
|