php - Do i have to escape input using mysqli_real_escape_string even though i check it using is_numeric to prevent sql injection -


I am using $ _GET ['id'] to get the ID And see it DB

I think if I use the is_numeric function to check the string, then it is numeric or not, then I use the mysqli_real_escape_string I>. But recently it was found.

It was found whether the given variable is numeric or not. Numeric strings include optional sign, any number of digits, optional decimal part, and optional exponential part. Thus + 0123.45e6 is a valid numeric value. There is also permission for hexadecimal (such as 0xf4c3b00c), binary (eg 0b 10101111001), October (eg 0777) signaling, but without any indication, decimal and exponential part referee:

The question is Do I have to avoid input using mysqli_real_escape_string, though I check it using is_numeric to prevent SQL injection ?

As the input will only have numerical value eg. 555, 222,456, 879

Although I can not think of a specific way of attacking your example, I can not think in a way! "=" This is not possible ".

If you come into the habit of checking, and then cross the values, then eventually you will get in Trouble!

Your statement "Input is only numeric value like 555, 222 ,456, 879" This is not true because you have given some more complicated examples in your quote - how do SQL + 0123.45 A6 or 0b10? A string in which there is a number

For this reason, always the US WARNING STATEMENTS - There is a need to worry about the way you do not do it. If you can find the reason for not using the prepared statement (and I do not think there is one! ) Then lets talk.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -