PHP判斷當前舊密碼是否正確
<?php
require_once('conn.php');
header("Content-type: text/html; charset=utf-8");
//echo $password.'555555';
if (isset($_POST['adminupdate'])) {
session_start();
$a=$_SESSION['password'];
$Id=$_GET["Id"];
$username = trim($_POST['username']);
$password1 = trim($_POST['password1']);
$password2 = trim($_POST['password2']);
$nns = trim($_POST['nns']);
$b=md5($_POST['password']);
//echo $a.'分割',$b;
if ($a!=$b) { //判斷舊密碼是否匹配
echo "<script>alert('舊密碼輸入錯誤!');location.href='admin_list.php';</script>";
exit;
}
if ($password1!=$password2) { //判斷新密碼是否匹配
echo "<script>alert('兩次密碼不一致!');location.href='admin_list.php';</script>";
exit;
}
$password2 = md5($password2);
$sql = "update admin set username='$username',password='$password2',nns='$nns' where Id=".$Id;
mysql_query($sql);
//echo $sql;die();
echo "<script>alert('修改成功!');location.href='admin_list.php';</script>";
}
?>
推薦文章
2025-01-18
2024-11-28
2024-11-09
2024-10-25
2024-06-25
2024-01-04
2023-11-06
2023-10-30
2023-10-13
2023-10-10
穩(wěn)定
產(chǎn)品高可用性高并發(fā)貼心
項目群及時溝通專業(yè)
產(chǎn)品經(jīng)理1v1支持快速
MVP模式小步快跑承諾
我們選擇聲譽堅持
10年專注高端品質(zhì)開發(fā)聯(lián)系我們
友情鏈接: