Jump to content

text box security


asmith

Recommended Posts

leaving an input filed with no limit ,can cause sql injections .

what about a text box  ?   

i want to allow the user to type anything he wants for something like "comments" . so he can use all the symbols ,space , everything .

and i want to record that in mysql field. 

how can i prevent my text box not to allowed sql injections  ?

 

( hmm i can combine the incoming text with some symbols at the its front and its end  , so to make it change from what it is exactly , but is there a better way for doing this ? )

Link to comment
https://forums.phpfreaks.com/topic/82669-text-box-security/
Share on other sites

mysql_real_escape_string - that does it all for you.

 

EXCEPT - I did read an article recently (which I can't locate right now) stating that if you entered the utf8 (either that or a similar character code) for a single quote then it is not escaped by mysql_real_escape_string but is evaluted as a single quote in a string and hence would permit injection.

 

Inject is only really a problem with select queries anyway - inserts and updates would only be affected in rare situations where your construction of the query string allowed the user inputted string to affect which/howmany rows were affected....

Link to comment
https://forums.phpfreaks.com/topic/82669-text-box-security/#findComment-420453
Share on other sites

I believe this

EXCEPT - I did read an article recently (which I can't locate right now) stating that if you entered the utf8 (either that or a similar character code) for a single quote then it is not escaped by mysql_real_escape_string but is evaluted as a single quote in a string and hence would permit injection.

is incorrect. The addslashes() function has this problem, not mysql_real_escape_string().

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/82669-text-box-security/#findComment-420598
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.