if(($newPassword == "") || ($confirmPassword == "") || ($currentPassword == ""))
{
echo "<script language='javascript'>alert('Please fill in the password')</script>";
}
else if ($password != $currentPassword)
{
echo "<script language='javascript'>alert('You have enter wrong current password.')</script>";
}
else if($newPassword != $confirmPassword)
{
echo "<script language='javascript'>alert('Please fill in the same password')</script>";
}
else if((ereg("^([a-zA-Z0-9])+",$newPassword))&& (ereg("^([a-zA-Z0-9])+",$confirmPassword))&& (ereg("^([a-zA-Z0-9])+",$currentPassword))){
$result3=mysql_query("UPDATE login SET Password='$confirmPassword' WHERE Username = '$Username'");
// echo "<script languege='javascript'>alert('Success Change')</script>";
echo "<script> window.location='password.php?Action=submit&Username=$Username'</script>";
}
else
{
echo "<script language='javascript'>alert('Please follow password format!!')</script>";
}
原帖由 小开心 于 2009-9-10 11:10 AM 发表
我想写个改password function的coding
可是遇到了一些问题
希望大大指点迷经
这样写出来后,遇到了写问题
如果我password里放;'[] 后再放字母/号码
他就会显示密码出错
但如果我方字母/号码加上;'., ...
原帖由 Super-Tomato 于 2009-9-10 04:42 PM 发表
你的 regular expression 只是判斷字串中是否有 a-zA-Z0-9 為開頭, 如果你輸入 abc123;[] 的話, reg 函數就會搜索到 abc123 和 ;[] 既然一開始的條件存在, 那麼就當然會回傳 1
p/s: 請看看 RE 中的 ...
欢迎光临 JBTALKS.CC (https://www.jbtalks.my/) | Powered by Discuz! X2.5 |