POST[‘id’]二次注入在网站业务在注入点出现在注册页reg.php
我们在注册的时候,如果’ union select 1,2,3,4#这样的语句能带入数据库,但没有直接利用办法,那就能通过查询search.php来sql注入
前端这里写一个Form
<form action="reg.php" method="POST">
id:<input type="text" name="id"><br>
username: <input type="text" name="username"><br>
password: <input type="password" name="password"><br>
email:<input type="text" name="email"><br>
<input type="submit" name="login">
</form>
为了方便,吧前端内容写入reg.php,这里注意<?php?> 第二个问好闭合就行。
同样,isset函数判断是否通过login属性登录,不是返回false失败
对变量做addslashes函数处理,如果脏数据被过滤只会返回查询失败。
$id $username $password $email
$id = addslashes($_POST['id']);
$username = addslashes($_POST['username']);
$password = addslashes($_POST['password']);
$email = addslashes($_POST['email']);