$cus_id = isset($_POST['cus_id']); $cus_origi_pass = $_POST['cus_origi_pass']; $hash_origi_password = md5($cus_origi_pass); $cus_new_pass = $_POST['cus_new_pass']; $hash_new_password = md5($cus_new_pass); $cus_confirm_pass = $_POST['cus_confirm_pass']; $sql = "SELECT * FROM customer WHERE cus_password ='$hash_origi_password' "; $result = mysqli_query($con, $sql); if ($cus_origi_pass == "") { echo "<script>alert('คุณยังไม่ได้กรอกรหัสผ่านเดิม');window.location='Cus_Edit_Pass.php';</script>"; } else if ($hash_origi_password == "1") { if ($cus_new_pass != $cus_confirm_pass) { echo "<script>alert('รหัสผ่านใหม่กับการยืนยันรหัสผ่านไม่ตรงกัน');window.location='Cus_Edit_Pass.php';</script>"; } else if (mysqli_num_rows($result) == 1) { //ถ้ารหัสผ่านตรง if (checkPassword($password)) { //ตรวจสอบว่ารหัสผ่านมีข้อความผสมตัวเลข $sqlUp = "UPDATE customer SET cus_password WHERE cus_id ='$cus_id'"; $relUp = mysqli_query($con, $sqlUp); echo "<script>alert('รหัสผ่านถูกเปลี่ยนเรียบร้อยแล้ว');window.location='Manage_Cus.php';</script>"; } else { echo "<script>alert('รหัสผ่านต้องมีทั้งอักษรและตัวเลข และยาวอย่างน้อย 8 ตัวอักษร');window.location='Cus_Edit_Pass.php';</script>"; } } } else { echo "<script>alert('คุณกรอกรหัสผ่านเดิมไม่ถูกต้อง');window.location='Cus_Edit_Pass.php';</script>"; }
$sql = "SELECT * FROM customer WHERE cus_password ='$hash_origi_password' add user_login = ? "; // แน่ใจเหรอว่ามันจะมี แค่ แค่พาสเดียว ให้ ตรวจสอบ user login ด้วย
$cus_id = isset($_GET['cus_id']); $cus_origi_pass = $_POST['cus_origi_pass']; $hash_origi_password = md5($cus_origi_pass); $cus_new_pass = $_POST['cus_new_pass']; $hash_new_password = md5($cus_new_pass); $cus_confirm_pass = $_POST['cus_confirm_pass']; $sql = "SELECT * FROM customer WHERE cus_password =$hash_origi_password AND cus_id = $cus_id "; //ตรวจรหัสผ่านเก่าว่าตรงกับที่อยู่ในฐานข้อมูลหรือไม่ $result = mysqli_query($con, $sql); if ($cus_origi_pass == "") { echo "<script>alert('คุณยังไม่ได้กรอกรหัสผ่านเดิม');window.location='Cus_Edit_Pass.php';</script>"; } else if ($result == "1") { if ($cus_new_pass != $cus_confirm_pass) { //เช็คว่ารหัวผ่านใหม่ตรงกับที่ยืนยันหรือไม่ เมื่อรหัสผ่านไม่ตรง echo "<script>alert('รหัสผ่านใหม่กับการยืนยันรหัสผ่านไม่ตรงกัน');window.location='Cus_Edit_Pass.php';</script>"; } else if (mysqli_num_rows($result) == 1) { //ถ้ารหัสผ่านตรง if (checkPassword($password)) { //ตรวจสอบว่ารหัสผ่านมีข้อความผสมตัวเลข $sqlUp = "UPDATE customer SET cus_password WHERE cus_id ='$cus_id'"; $relUp = mysqli_query($con, $sqlUp); echo "<script>alert('รหัสผ่านถูกเปลี่ยนเรียบร้อยแล้ว');window.location='Manage_Cus.php';</script>"; } else { echo "<script>alert('รหัสผ่านต้องมีทั้งอักษรและตัวเลข และยาวอย่างน้อย 8 ตัวอักษร');window.location='Cus_Edit_Pass.php';</script>"; } } } else { echo "<script>alert('คุณกรอกรหัสผ่านเดิมไม่ถูกต้อง');window.location='Cus_Edit_Pass.php';</script>"; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง