<?php session_start(); include("inc/function.php"); chk_member(); // Call function chk_member() ?> <!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> <form id="form1" name="form1" method="post" action="changepassword_save.php"> <table width="350" border="1" align="center"> <tr> <td colspan="2" align="center" bgcolor="#FFFF99">. : Change Password : .</td> </tr> <tr> <td width="122" align="center" bgcolor="#FFCC99">Old Password</td> <td width="212" bgcolor="#FFCC99"><label for="oldpass"></label> <input type="password" name="oldpass" id="oldpass" /></td> </tr> <tr> <td align="center" bgcolor="#FFCC99">New Password</td> <td bgcolor="#FFCC99"><label for="newpass"></label> <input type="password" name="newpass" id="newpass" /></td> </tr> <tr> <td align="center" bgcolor="#FFCC99">Renew Password</td> <td bgcolor="#FFCC99"><label for="renewpass"></label> <input type="password" name="renewpass" id="renewpass" /></td> </tr> <tr> <td colspan="2" align="center" bgcolor="#FFFF99"><input type="submit" name="Submit" id="Submit" value="• Change •" /></td> </tr> </table> </form> </body> </html>
<?php session_start(); include("inc/function.php"); chk_member(); // Call function chk_member() ?> <!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> <?php $oldpass = $_POST['oldpass']; $newpass = $_POST['newpass']; $renewpass = $_POST['renewpass']; // check oldpass, newpass, renewpass not empty // check oldpass == password in tb members ? (เช็ค oldpass ใน table member) // check newpass == renewpass // check newpass as less 6 chars (เช็ค new pass อย่างน้อย 6 ตัวอักษร) // encrypt newpass by md5 (ใส่ newpass ด้วย md5) // Update newpass to tb members if( empty($oldpass) || empty($newpass) || empty($renewpass) ) { exit("<script> alert('Please Check Your Password Again'); history.back(); </script>"); } if( $newpass != $renewpass ) { exit ("<script> alert('Please check password'); history.back(); </script>"); //คำสั่ง newpass,renewpass ต้องตรงกัน } if( strlen($newpass) < 6 ) // คำสั่งให้ใส่ password มากกว่า 6 ตัว { exit ("<script> alert('Password as less 6 char'); history.back(); </script>"); } include("inc/connect.php"); $newpassword = "$newpassword"; $sql = "UPDATE members SET password = '$password' WHERE id = ' {$_SESSION ['sess_id'] }' "; mysql_query( $sql ) or die( mysql_error().":$sql"); $_SESSION['sess_password'] = $password; exit("<script> alert('complete'); window.location='member.php'; </script>"); ?> </body> </html>
$newpassword = "$newpassword"; $sql = "UPDATE members SET password = '$password'
<? session_start(); if($_SESSION['UserID'] == "") { echo "Please Login!"; exit(); } mysql_connect("localhost","root","root"); mysql_select_db("mydatabase"); if($_POST["txtPassword"] != $_POST["txtConPassword"]) { echo "Password not Match!"; exit(); } $strSQL = "UPDATE member SET Username = '".trim($_POST['txtPassword'])."' ,Name = '".trim($_POST['txtName'])."' WHERE UserID = '".$_SESSION["UserID"]."' "; $objQuery = mysql_query($strSQL); echo "Save Completed!<br>"; if($_SESSION["Status"] == "ADMIN") { echo "<br> Go to <a href='admin_page.php'>Admin page</a>"; } else { echo "<br> Go to <a href='user_page.php'>User page</a>"; } mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง