php - when and how should i use this functions? -


i have script in php , mysql , want secure inputs against sql enjection.
know functions don't know , how should use them.
functions are:

nl2br() preg_replace() htmlspecialchars() mysql_real_escape_string() htmlentities() 

and inputs are:

username password mobile email url description (text area) 

anyone can explain me should do?

thanks

you have use newer version of mysql driver called mysqli or can use alternative pdo

you can use database in combination prepared statements. way defend against sql injection. take time chose 1 of classes , learn how use them.

ps,

still sql injection not thing have worry about. can add javascript in public form hide page or that. can use filter them out preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $var); still 1 example there more learn take @ pdo or mysqli , start building.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -