Jump to content

Recommended Posts

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";

Link to comment
https://forums.phpfreaks.com/topic/197519-php-form-filter/
Share on other sites

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.