English 中文(简体)
PHP Input Validation - Situation to be known?
原标题:PHP Input Validation - Things to be aware of?

我正在设立一个功能,验证用户对案文的投入。 由于我对投入案文有多种用途,我希望这一职能能够涵盖尽可能多的领域,涉及在网站任何部分发布用户投入案文的安全关切。 目前,我利用各种密码,根据需要验证各种投入,并试图将其中的安全部分合并为一项职能,并将(电子邮件、电话、密码验证)并入另一个可在网站使用的系统。

我有这个问题。

我在核对数据库中信息输入时,利用这一过滤线来清理用户的投入:

$find = strtoupper($find); 
$find = strip_tags($find); 
$find = trim ($find);
$_SESSION[ find ] = $find;
$keywords_array = explode(   , $find);

如果我使用<代码>strip_tags 在应用上述过滤器之前验证这种投入是有意义的:

if (preg_match("#script#",$_POST[ search ]))
        {
            // Get user ip
            // Log client details to DB
            $GLOBALS[ errorFocus ] = "autofocus class= thisInputIsError ";
            $GLOBALS[ searchError ] =  <p>Your IP has been logged!</p> ;
        }

如果是的话,其他各方应当注意什么?

Also what other things should I be watching out for in general in regards to the function I am trying to put together?

与一些裁军部辅导机构的任何联系也非常密切:

谢谢!

最佳回答

php does have filtering and validation built-in, read http://php.net/manual/en/book.filter.php you might also consider HTMLpurifier or tidy if you want custom-filter HTML content

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签