<? $host = "localhost"; $user = "root"; //user ฐานข้อมูล $passwd = "1234"; //pass ฐานข้อมูล $dbname = "change"; $conn=mysql_connect($host,$user,$passwd) or die("ติดต่อ Host ไม่ได้"); mysql_select_db($dbname) or die("ติดต่อฐานข้อมูลไม่ได้"); mysql_query("SET NAMES UTF8",$conn); ?>
<? session_start(); ob_start(); ?> <!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"> <!-- .style1 {font-size: 14px} --> </style> </head> <body> <? if($_SESSION['id'] == ""){ ?> <form id="CheckLogin" name="CheckLogin" method="post" action="CheckLogin.php"> <div align="center"> <table width="200" border="0"> <tr> <td align="right" valign="middle"><span class="style1">ID : </span></td> <td align="left" valign="middle"><label> <input type="text" name="Username" id="Username" /> </label></td> </tr> <tr> <td align="right" valign="middle"><span class="style1">PASS : </span></td> <td align="left" valign="middle"><label> <input type="password" name="Password" id="Password" /> </label></td> </tr> <tr> <td> </td> <td align="left" valign="middle"><label> <input type="submit" name="button" id="button" value="Login" /> </label></td> </tr> </table> </div> </form> <? }else{ include "connect.php"; $strSQL = "select * from member where id = '".$_SESSION['id']."' "; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); ?> <form id="Logout" name="Logout" method="post" action="Logout.php"> <div align="center"> <table width="200" border="0"> <tr> <td align="right" valign="middle"><span class="style1">ID : </span></td> <td align="left" valign="middle"><label> <?=$objResult["name"];?> </label></td> </tr> <tr> <td align="right" valign="middle"> </td> <td align="left" valign="middle"><label><a href="ChangePass.php">ChangePassword</a></label></td> </tr> <tr> <td> </td> <td align="left" valign="middle"><label> <input type="submit" name="button" id="button" value="Logout" /> </label></td> </tr> </table> </div> </form> <? } ?> </body> </html>
<? session_start(); ob_start(); ?> <!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> </head> <body> <? include "connect.php"; $strSQL = "select * from member where name = '".trim($_POST['Username'])."'and pass = '".trim($_POST['Password'])."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult){ echo "<script>alert('Username หรือ Password ไม่ถูกต้อง!')</script>"; echo "<meta http-equiv='refresh' content='1; url=Login.php'>"; }else{ $_SESSION["id"] = $objResult["id"]; session_write_close(); header("location:Login.php"); } mysql_close(); ?> </body> </html>
<? session_start(); ob_start(); session_unset(); session_destroy(); header("Location:Login.php"); ?>
<? session_start(); ob_start(); ?> <!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> <script language="javascript"> function check(){ if(document.ChangePass.passold.value==""){ alert('กรุณากรอก PASSWORD เก่า'); document.ChangePass.passold.focus(); return false; }else if(document.ChangePass.passnew.value==""){ alert('กรุณากรอก PASSWORD ใหม่'); document.ChangePass.passnew.focus(); return false; }else if(document.ChangePass.passnew1.value==""){ alert('กรุณายืนยัน PASSWORD ใหม่'); document.ChangePass.passnew1.focus(); return false; }else if(document.ChangePass.passnew.value != document.ChangePass.passnew1.value){ alert('คุณใส่ password ไม่ตรงกัน'); document.ChangePass.passnew1.focus(); return false; } return true; } </script> <style type="text/css"> <!-- .style1 {font-size: 14px} --> </style> </head> <body> <form id="ChangePass" name="ChangePass" method="post" action="CheckChangePass.php" onsubmit="return check()"> <div align="center"> <table width="306" border="0"> <tr> <td colspan="2" align="center" valign="middle"><span class="style1">เปลี่ยนรหัสผ่าน</span></td> </tr> <tr> <td align="right" valign="middle"><span class="style1">รหัสเก่า : </span></td> <td><label> <input type="password" name="passold" id="passold" /> </label></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td align="right" valign="middle"><span class="style1">รหัสใหม่ :</span> </td> <td><label> <input type="password" name="passnew" id="passnew" /> </label></td> </tr> <tr> <td align="right" valign="middle"><span class="style1">ยืนยันรหัสใหม่ : </span></td> <td><label> <input type="password" name="passnew1" id="passnew1" /> </label></td> </tr> <tr> <td colspan="2"><div align="center"> <label> <input type="button" name="button2" id="button2" value="กลับ" onclick="history.go(-1)" /> <input type="submit" name="button" id="button" value="ยืนยัน" /> </label> </div></td> </tr> </table> </div> </form> </body> </html>
<? session_start(); ob_start(); ?> <!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> </head> <body> <? include "connect.php"; $strSQL = "select * from member where id = '".trim($_SESSION['id'])."'and pass = '".$_POST['passold']."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult){ echo "<script>alert('Password เดิมไม่ถูกต้อง!')</script>"; echo "<meta http-equiv='refresh' content='1; url=ChangePass.php'>"; }else{ $sql = "update member set pass = '".$_POST[passnew]."' where id = '".$_SESSION['id']."' "; $result = mysql_query($sql); echo "<script>alert('เปลี่ยน Password เสร็จเรียบร้อบ')</script>"; echo "<meta http-equiv='refresh' content='1; url=Login.php'>"; } mysql_close(); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง