Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php form submit security 1

Status
Not open for further replies.

theEclipse

Programmer
Dec 27, 1999
1,190
US
I know that in perl, it is a security risk not to escape characters like % $ ect.....in order to prevent against form hacks.

Any suggestions as to what I should be testing for in my php form to databases.

Robert

Robert Carpenter
/b{2}|!b{2}/ - that is the question...
robert@convertingchaos.com
 
dunno. but, you can always use functions already existing that escape all the needed chars, like htmlspecialchars(transforms all unusual chars into their html notation), addslashes(escapes unusual chars), urlencode(transforms unusual chars into their hex/url notation), etc. just start giving a look at those functions in php.net and you should find your way ;)

jamesp0tter,
mr.jamespotter@gmail.com

p.s.: sorry for my (sometimes) bad english :p
 
There are special escape function, e.g. mysql_escape_string(). The PHP manual states that:
Using mysql_real_escape_string() around each variable prevents SQL Injection.

As for parameters that will be passed to any kind of shell (exec, passthru etc.) there is escapeshellcmd() to render injected meta chars harmelss.

But, in general, you would do anything that you do in Perl like input data validation (most important). Never trust user input until it is carefully validated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top