<?php
$user = 'john';
$pwd = "' OR ''='";
$sql = "SELECT * FROM users WHERE
user='" . $user . "' AND password='" . $pwd . "'";
echo $sql.'<br />';
// escape username and password for use in SQL
$user = mysql_real_escape_string($user);
$pwd = mysql_real_escape_string($pwd);
$sql_escaped = "SELECT * FROM users WHERE
user='" . $user . "' AND password='" . $pwd . "'";
echo $sql_escaped;
?>
表明:
SELECT * FROM users WHERE user='john' AND password='' OR ''=''
SELECT * FROM users WHERE user='john' AND password='\' OR \'\'=\''
问题:
mysql如何解释这一行:password='\' OR \'\'=\''
?password
等于\
还是什么?