android6011 Posted September 17, 2008 Share Posted September 17, 2008 Basically all I want are alphanumeric and basic symbols allowed. I dont want to allow tags of any sort etc. Right now I have strip_tags() and mysql_real_escape_string to keep safe from rogue user input. Any other suggestions? also, due to other problems i have magic quotes turned off in my config if that changes anything. thanks Quote Link to comment https://forums.phpfreaks.com/topic/124733-filter-user-input/ Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 If you want to verify it before they submit, you will need to write a javascript function. Otherwise, you could create a PHP function that strips out any characters that you don't want. Quote Link to comment https://forums.phpfreaks.com/topic/124733-filter-user-input/#findComment-644299 Share on other sites More sharing options...
android6011 Posted September 18, 2008 Author Share Posted September 18, 2008 I just don't want anything html wise or anything that could be injection related, and id prefer to do it on the php end after submission Quote Link to comment https://forums.phpfreaks.com/topic/124733-filter-user-input/#findComment-644317 Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Maybe try this: <?php function CheckChars($input){ $chars = array('a','b','c','d',1,2,3...); //list all acceptable characters $output = ""; foreach (explode("",$input) as $char){ if (in_array($char,$chars)) $output .= $char; } return $output; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/124733-filter-user-input/#findComment-644318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.