logo © 1996 Phil Waclawski
Felitaur Site
Offerings
About Me
Crafts
Services
ftp files
Help Files
What's New?
Home Page
Other Links
Anatomy &
Physiology
Arthropods
Biology
Computers
Ferrets
Fun Links
Internet
Linux
S.C.A.
Win 95/NT
Comments or
Suggestions
webmaster@ felitaur.com
   
[Webscripting Homepage] | [Javascript Homepage] | [Perl/CGI HomePage] | [PHP Homepage]

PHP Regular Expressions and Objects

Creating a cleaner.inc.php

This project will require at least two files, your cleaner.inc.php (based off the cleanerclass04.inc.php I gave you) And the main filecleanertester.php
  • You will have this program create a simple form that uses the following fields:
    • A firstname, middle initial and lastname textbox
    • A password box
      range of 8-40 characters must be allowed (no less than 8, no more than 40) and allow the following characters a-zA-Z0-9!@#$%^&*
    • A second password box to make sure they typed the same as the first one
    • An email address in a text box
    • A text area field
    • One set of radio buttons
    • One select menu
  • You will use the cleanerclass.inc.php to filter out ALL your input, so you will need to add the appropriate sections to the example I gave you
  • My example (cleanerclass04.inc.php) gives you the regex for several types of filters, you just need to apply them appropriately.
  • You will use preg_match to validate the password and email fields
  • use strip_tags(), preg_replace(),htmlentities(), nl2br() and similar functions to clean up the textarea field and name field
  • Print out the "cleaned" results on a result page, and format the text area field to preserve their line breaks (ie match a \n or a \r\n and replace with a \n<br />
  • Print the date at the bottom of the page in the format Thursday, November 6, 2014

This page last updated on: