eerikk2 Posted April 4, 2010 Share Posted April 4, 2010 I have a form for people to upload data to a mysql database. I am trying to include a filter to prevent them from uploading explicit terms into any of the spaces. I made the from which when submitted goes to insert.php file which processes all the data and uploads it. here is where i would like to preform the filter. maybe it would be something like if($_POST ['name']=='@$#'){ header ('Location: example.com')} Although i have many form sections and many words i would like to filter out. The goal is to, if one of the words is detected it would redirect the user to a page which displays why their data was not uploaded. I've been trying to do this and here is what i've got so far. //insert.php include('words.php'); if ($_POST['$entered']=="$words"){ header( 'Location: http://example.com/' ) ; exit; } //words.php //%is used as wildcard in code $words ="%@$#%||%@$#%||%@$#%||%@$#%||%@$#%||%@$#%||%@$#%"; $entered="Mname||Sname||Lsize||Wsize||Dsize"; Quote Link to comment https://forums.phpfreaks.com/topic/197519-php-form-filter/ Share on other sites More sharing options...
greatstar00 Posted April 4, 2010 Share Posted April 4, 2010 you would need to use preg_match if u want to use wildcard characters which it belong to regular expression Quote Link to comment https://forums.phpfreaks.com/topic/197519-php-form-filter/#findComment-1036700 Share on other sites More sharing options...
eerikk2 Posted April 4, 2010 Author Share Posted April 4, 2010 oh ok thank you very much so my if would look like this? if ($words){ header( 'Location: http://example.com/' ) ; exit; } and the words.php would be this? $words = preg_match("/@$#/i", "/@$#/i"); Quote Link to comment https://forums.phpfreaks.com/topic/197519-php-form-filter/#findComment-1036867 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.