Jump to content

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/10919-sanitizing-all-input-this-way/
Share on other sites

[!--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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.