php 防sql代码

WBOY
Release: 2016-06-23 13:37:23
Original
849 people have browsed it

最近在学习,php mysql
请问下,提交表单后,在插入数据库之间,
这样写够吗?还要写其它的防sql代码吗?
$name=mysql_real_escape_string($_POST['name']);


回复讨论(解决方案)

百度一下“360通用防注入”可以作为参考

百度一下“360通用防注入”可以作为参考


 O(∩_∩)O谢谢

我这样写有什么问题吗

这样写就可以了


百度一下“360通用防注入”可以作为参考


 O(∩_∩)O谢谢

我这样写有什么问题吗
可以了

我也刚学.我觉得直接学PDO,带参数的查询.反正都是刚开始学.省事.

一般用addslashes函数;mysql_real_escape_string必须是连接数据库之后才能使用

1.对用户的数据进行验证   如是数字的必须是数字 
2.addslashes函数
3.mysql_real_escape_string 或者mysql_escape_string
4.预编译sql  prepare

我觉得使用360safe就还算不错了,有时间就研究!!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!