PHP Classes
Icontem

File: Example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Hayes  >  Validit  >  Example.php  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Validit
Validate user submitted data
 

Contents

Class file image Download
<?php 
//============================ 
//        Example              
//============================ 

include_once('Validit.php');

$v = new Validit();

// Check for alpha strings and length. This time we want to allow space (\t\r\n) so take 
// note of the third parameter passed to alphaCheck(). This is optional and if left out will 
// prevent strings from containing space.
$v -> alphaCheck($v -> lengthCheck($_GET['name'], 'name length problem'302), 'name contains illegal characters''[:space:]');

// Check for validate email address format and length
$v -> emailCheck($v -> lengthCheck($_GET['email'], 'email length error'807), 'invalid email address');

// Check for integer and length
$v -> numericCheck($v -> lengthCheck($_GET['num'], 'number length error'252), 'not an integer');

// Check for alpha numeric strings and length. This time we want to allow space (\t\r\n) so take 
// note of the third parameter passed to alphaNumericCheck().
$v -> alphaNumericCheck($v -> lengthCheck($_GET['address'], 'address length problem'205), 'address contains illegal characters''[:space:]');

// Check for alpha numeric strings and length. Again take note of the third parameter passed to 
// alphaNumericCheck() this time we want to allow the '_' character
$v -> alphaNumericCheck($v -> lengthCheck($_GET['pass'], 'password length problem'205), 'password contains illegal characters''_');

// Check strings
$v -> compareCheck($_GET['pass'], $_GET['pass2'], 'passwords don\'t match');



// Output errors (if any)
foreach($v -> getErrors() as $output
{
    echo (
$output.'<br>'); 
}

// Reset error list
$v -> resetErrorList(); 

?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products