search
Homephp教程php手册PHP的数据过滤防注入的方法.

PH编程中,处理提交数据并过滤非法字符防注入的方法.

插入数据时用addslashes()就好了,其他的再根据需要进行处理。

不管magic_quotes_gpc是On还是Off,添加数据时都用addslashes(),当On时,必须使用stripslashes(),Off时则不能用stripslashes()。

//提交数据,或者变量准备:
$Content=addslashes("这里面是数据,不管有没单引号或者还是变量");
//插入数据到数据库,代码省略

//开始显示数据
$Content="从数据库读取的数据";
if(get_magic_quotes_gpc()){ $Content=stripslashes($Content); }



Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools