我有用於更改用戶密碼的php代碼。但是在我嘗試了代碼之後......提交新密碼時......新密碼在sql數據庫中顯示出來了......我希望它在md5密碼中。能否請您與我的代碼解決這個問題使用MD5更改密碼錶單?
if($_REQUEST['do'] == 'edit')
{
$title = 'change password';
$page = $_POST['page'];
$userId = safe($_POST['userId']);
$passwd = safe($_POST['password']);
$email = safe($_POST['Email']);
$passw2 = $_POST['password2'];
if(md5($passwd) == $_SESSION['user']['password'])
{
if(empty($passw2))
{
$pass = $_SESSION['user']['password'];
}
else
{
$pass = $passw2;
}
$query = $db->query("UPDATE users SET email = '".$email."' , password = '".$pass."' WHERE Id = '".$userId."' ");
if($query)
{
$msg = "password changed successfully";
}
你把標題中的PHP,但沒有將它添加爲標籤? – Will