-2
如何解码$_get
变量使用PHP与出表单的方法?如何解码获取变量在PHP
HTML代码
<a id="msgr"name="msgr<?php echo $d['qid'];?>"href="Chatbox.php">message</a>
PHP代码(chatbox.php)
if(isset($_get["msgr"])){
$get_id=mysqli_fetch_array(mysqli_query($connection,"SELECT MAX(qid)
FROM `queries` WHERE uid='".$_SESSION['id']."'"));
$result = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM
`queries` where qid='".$get_id[0]."'"));
}
我怎样才能像URL example.com/chatbox.php?qid=212 ? 请给予解释并给我解决方案。在此先感谢
'$ _GET'不存在。然而'$ _GET'确实是 – RiggsFolly
'$ _GET'变量是基于查询字符串内容作为关联数组填充的。这可以通过提交表单或使用查询字符串设置URL来完成。你在这里没有做这些事情。 – apokryfos
你的脚本存在[SQL注入攻击]的风险(http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) 即使[如果你正在逃避输入,它不安全!](http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string) 使用[编写的参数化语句](http:// php。净/手动/ EN/mysqli.quickstart.prepared-statements.php) – RiggsFolly