40esp Posted March 22, 2008 Share Posted March 22, 2008 Im trying to protect my web application from sql injection, but i need some help filtering out all of the bad characters from my posted textfield ( $_POST['user']; ) such as ();'>=< how would i do this. Im stumped. If anyone could provide an example that would be great. Thank you. Link to comment https://forums.phpfreaks.com/topic/97424-php-filter-_post/ Share on other sites More sharing options...
40esp Posted March 22, 2008 Author Share Posted March 22, 2008 actually, ive obtained info to fix it. thanks and sorry. for anyone that wants it: function security($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $value = security($_POST['value']); echo $value; Link to comment https://forums.phpfreaks.com/topic/97424-php-filter-_post/#findComment-498488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.