Jump to content


Photo

Sanitizing all input this way


  • Please log in to reply
2 replies to this topic

#1 morpheuz

morpheuz
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 01 June 2006 - 03:46 AM

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?

#2 morpheuz

morpheuz
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 01 June 2006 - 02:03 PM

[img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] bump

#3 mushroom

mushroom
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts
  • LocationQueen Charlotte B. C. Canada

Posted 01 June 2006 - 05:16 PM

[!--quoteo(post=379067:date=Jun 1 2006, 09:03 AM:name=morpheuz)--][div class=\'quotetop\']QUOTE(morpheuz @ Jun 1 2006, 09:03 AM) View Post[/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
$never_in_pswd=array(" ","\"","!","@","$","%","^","(",")",":",";",",","|","<",">","=","'");
Validate like this
$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";}
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users