*嗨我总是收到错误查询失败,但我没有在apache2日志是≤<
我想在不登录网站的情况下更改帐户密码。
希望有人能帮我解决这个问题。
//清理POST值
$login = clean($_POST['login']);
$email = clean($_POST['email']);
$newpw = clean($_POST['newpass']);
$cnewpw = clean($_POST['cnewpass']);
//Input Validations
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($email == '') {
$errmsg_arr[] = 'Email missing';
$errflag = true;
}
if($newpw == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
if($cnewpw == '') {
$errmsg_arr[] = 'Confirm password missing';
$errflag = true;
}
if( strcmp($newpw, $cnewpw) != 0 ) {
$errmsg_arr[] = 'Passwords do not match';
$errflag = true;
}
//检查重复的登录ID
if($login != '' && $email != '') {
$qry = "SELECT * FROM t_account WHERE name='$login' AND email='$email'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) < 1) {
$errmsg_arr[] = 'Username and or Email is not in our system!';
$errflag = true;
}
@mysql_free_result($result);
} else {
die("Query Failed");
}
//Create update query
$qry = "UPDATE t_account SET (pwd, pw2) VALUES('".md5($_POST['newpass'])."','$newpw')";
$result = @mysql_query($qry);
//Check whether the query was successful or not
if($result) {
header("location: register-success.html");
exit();
}else {
die("mysql_error");
}
}
&GT;
*
答案 0 :(得分:0)
您可以通过phpMyadmin更改密码。检查密码生成器代码。它必须是md5我猜。
答案 1 :(得分:0)
输入if尝试打印$ query字符串的值后,在tour SQL客户端上复制粘贴IT并看看你得到了什么
答案 2 :(得分:0)
您的Update-String的SQL语法不正确(至少在ANSI-SQL中)。
是
INSERT INTO table (col1,col2) VALUES...
或
UPDATE table set col1=val1, col2=val2 WHERE...