English 中文(简体)
php的安保优先功能是使投入制度化
原标题:security preference in php, php functions to sanitize input

I have the following function that sanitizes input from the user or the url:

   function SanitizeString($var)
   {
       $var=stripslashes($var);
       $var=htmlentities($var, ENT_QUOTES,  UTF-8 );
       $var=strip_tags($var);
       return $var;
   }

I dont知道,除了这一网站外,是否利用这一功能:

我sql_real_einski_string()。

我也非常想知道,我是否采取一切预防措施,使这一投入制度化。

我也存在一个 strip锁问题。 平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等、平等

我怎么回去将html的特性作为html特性,然后再输入数据库?

最佳回答

如果你在把超文本放在屏幕上(你在你的问话中确实没有提及,但在你的评论中确实提到这个问题),那么,这比你可能认为更为复杂。

Take a look at: http://iamcal.com/publish/articles/php/processing_html/ and http://www.iamcal.com/publish/articles/php/processing_html_part_2/

问题回答

Sanitizing inputs a priori, no matter what, is wrong. What does stripping tags has to do with databases? Since when malicious scripts run inside a database? Being overprecautius is a good thing, except when you do it without a logic.

只根据需要达到的“专线”内容加以实现。

A database? then escape for the database, to avoid SQL injections. Use mysql_real_escape_string() or parametrized queries and you re set.

Html page? • 宣传你的html,以避免特别安全局和其他新生事物。 http://www.php.net/manual/en/Function.html-entity-decode.php”rel=“nofollow”<>htmlentities(, 或其他更为复杂的解决方案,但JUST BEFORE OUTPUTATION。

如果你在剪辑中节省了html网页,而你则把所有标签隔开(btw,ine_tags())的工作做得不好,并在>>>> > >htmlentities(不是最好的事情)? 如果你后来需要回来? 就这一点而言,数据库使用<代码><script> tag或链接到malaware对数据有什么损害? Aren t 仅在一页重印时才有害吗?

To decode form htmlentities(), Just use. html_entity_decode(

在存储一个(MYSQL)数据库中的东西时,你希望使用<密码>mysql_real_einski_string。 如果您重新使用《发展纲领》并准备发言,《发展纲领》将照顾你们。 这保护了你免遭卡片人攻击。

当你印刷用户生成内容(文字、评论等)时,你想要使用<代码>htmlspecialchars或htmlentitites,或者在你之前就使用过任何东西。 什么是适当的,取决于您的使用情况。 无论由谁来决定,你只需要。 这将保护你们免遭特别安全局的袭击。

页: 1 等等,只要magic quotes残疾





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

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 = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签