morpheuz Posted June 1, 2006 Share Posted June 1, 2006 I've been reading articles on security and things for awhile now and I wonder if just refusing to allow undersired chars to be submitted through forms via exp is enough for the job, ie. reject: <>|{}[];:' "?/\+=()*&^%$#@!~` and only allow A-Z and 0-9?If anything submitted contains the above in a $_POST/$_GET, etc. kill the script and force the user to resubmit the data with the undesired removed. I guess a str replace code to compensate for not being able to use punctuation marks in text fields intended for messages would have to be present..but for login, search, urls, etc. I'd want it to stay free of them and the rest.Is this too much? Not enough? Comments? Quote Link to comment https://forums.phpfreaks.com/topic/10919-sanitizing-all-input-this-way/ Share on other sites More sharing options...
morpheuz Posted June 1, 2006 Author Share Posted June 1, 2006 [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] bump Quote Link to comment https://forums.phpfreaks.com/topic/10919-sanitizing-all-input-this-way/#findComment-40910 Share on other sites More sharing options...
mushroom Posted June 1, 2006 Share Posted June 1, 2006 [!--quoteo(post=379067:date=Jun 1 2006, 09:03 AM:name=morpheuz)--][div class=\'quotetop\']QUOTE(morpheuz @ Jun 1 2006, 09:03 AM) [snapback]379067[/snapback][/div][div class=\'quotemain\'][!--quotec--][img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] bump[/quote]Do you mean like this[code]$never_in_pswd=array(" ","\"","!","@","$","%","^","(",")",":",";",",","|","<",">","=","'");[/code]Validate like this[code]$i=0;while ( $i < strlen($p_word)){if (in_array($p_word[$i],$never_in_pswd)) { $e_message="\"$p_word[$i]\" is not allowed in a password";}[/code]Works for me [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] mind you there is a more code needed, but that just the part you a looking for Quote Link to comment https://forums.phpfreaks.com/topic/10919-sanitizing-all-input-this-way/#findComment-40964 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.