我有這樣的代碼,以及完美的作品,但我想作一個簡單的修改的mysqli - 問題mysqli_real_escape_string
<?php session_start();
require 'includes/f_banco1.php';
require '../PasswordHash.php';
function checkBd($sql, $db, $user, $codePass) {
$user = $_GET['userid']; //here
$codePass = $_GET['code'];//here
if(is_numeric($user)) {
($sql = $db->prepare("select userid, code from password_reset where userid=? and code=?"));
$sql->bind_param('ss', $user, $codePass);
$sql->execute();
$sql->bind_result($user, $codePass);
if ($sql->fetch()) {
$_SESSION['u_name']= sha1($user);
header("location: updatePass.php");
return true;
}
else
echo "Não existe na BD";
return false;
}
else
echo "Erro";
}
checkBd ($sql, $db, $user, $codePass);
?>
我想這方面的變革
$user = $_GET['userid']; //here
$codePass = $_GET['code'];//here
到
$user = mysqli_real_escape_string($db, $_GET['userid']);
$codePass = mysqli_real_escape_string($db, $_GET['code']);
但隨着這種改變代碼簡單停止工作,$用戶的回聲不顯示任何東西
有什麼想法嗎?
謝謝
的可能重複(http://stackoverflow.com/questions/1561586/are- php-mysqli-prepared-queries-bound-parameters-secure) – outis 2012-07-19 10:04:27