English 中文(简体)
IS 添加1个安全途径,以防 s射中的数字值?
原标题:IS multiplying by 1 a safe way to clean numeric values against sql injections?

我很想知道,如果我知道有价值的话,那么,用1个安全的方法来加以补充?

function x($p1){
   $p1*=1;
   sql="select * from t where id ={$p1}";
   //run query..
}

虽然我的例子使用了一个身份证,但用于我所看到的许多类型的数字价值(钱可以算起,可以算起)。

最佳回答

我看不出为什么如此。 但是,使用准备发言有什么错误? 这总是比在报表中直接使用购买力平价变量更为安全。

问题回答

您可使用_is_vidic()。

我肯定会采取更多的“适当”方式,但就你的问题范围而言,我要说是的。 如果采用某种扼制法,在进行数学操作时,将把它解释为零。

You can also use is_int()

它在大部分时间工作,因为它将给愤怒或两倍带来扼杀,但必须谨慎。 它将为cal价值正确工作。 然而,如果你这样做的话:

x(new stdClass);

页: 1 这不是坏的,权利如何? 这是:

x(array());

页: 1

也许你们会认为,它非常糟糕,但是,在不合适的时候,一个致命的错误可能会使你的系统陷入不稳定状态,例如,失去参考性的完整性或留下一系列未完成的问题。

只有你知道,如上所述案件能否发生。 但是,如果这种数据来自用户,那么我就拿到了《穆尔佩斯法》,而不是相信。





相关问题
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 ...

热门标签