Jump to content

security question:scrubbing user input


studentofstone

Recommended Posts

I am trying to keep the user input clean with this script but can't figure out what is wrong with it.

the error I am getting is Warning: preg_match() expects parameter 1 to be string,

$bad_strings = array(
                "content-type:",
                "mime-version:",
                "multipart/mixed",
			"Content-Transfer-Encoding:",
                "bcc:",
			"cc:",
			"to:",
  						);
if (preg_match($bad_strings, $first_name)) {
    die;

Link to comment
https://forums.phpfreaks.com/topic/224882-security-questionscrubbing-user-input/
Share on other sites

preg_match takes (string, string) and you're passing in an array for the first parameter.  Not entirely sure what you're trying to do here...  If you want to check if $first_name exists in the array of bad words then use in_array.

preg_match takes (string, string) and you're passing in an array for the first parameter.  Not entirely sure what you're trying to do here...  If you want to check if $first_name exists in the array of bad words then use in_array.

I am trying to make sure the user input (which will be emailed after processing) is only being sent to the proper address by explicitly keeping out bcc: cc: etc. I already have a fair amount of validation, but I wanted to be sure people don't steal the data.

Is there a better way?

 

Warning: preg_match() expects parameter 1 to be string

 

$bad_strings = array(

/slaps forehead/

of course.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.