Jump to content

PHP Filter / Sanatization


Recommended Posts


I have recently been attempting to make HTML forms in my website filtered by PHP strings... I have a PHP Filter that should work, However I am not sure on how to Integrate it into my HTML forms. Here is what I have right now...



<h3>Add Site Manual</h3><div class="addurlSmall">Enter the Site Title, Url and Description you want to add, it will automatically add it in the database</div><br /><?php require 'BannedWords.php';?><form action="/index.php?a=admin" method="post"><div class="">	Site Title: <input type="text" name="addtitle" value="" required /><br />	Site URL: <input type="url" name="addurl" value="http://" required /><br />	Site Description: <br /><textarea lass="ads" name="adddesc" required></textarea></div><br /><input type="submit" value="Add new result"/></form>

PHP Filter.

<?php$ban_array = array(  'Bad',  'Words',  'Here');$input_array = array (  'adddesc',  'addurl',  'addtitle');$isvalid = true;foreach ( $ban_array as $v ) {  foreach ( $input_array as $vv ) {    if ( strpos($form->data[$vv], $v) !== false ) {      $form->validation_errors[$vv] = 'Banned words in use!!';      return false;    }  }}?>

Any help would be appreciated :) Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...