Login   Register  
PHP Classes
elePHPant
Icontem

File: classes/sign_in.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of johno dread  >  Custom Form Validation  >  classes/sign_in.php  >  Download  
File: classes/sign_in.php
Role: Example script
Content type: text/plain
Description: Demonstrates validating a simple form
Class: Custom Form Validation
Validate form values according to several rules
Author: By
Last change:
Date: 2010-04-18 10:45
Size: 1,196 bytes
 

Contents

Class file image Download
<?php
/**
 * @copyright 2010
 */


session_start();

require_once(
'validation.php'); 
$valid = new validation;

if( isset(
$_POST) && count($_POST) > 0)
{    
    
// set error messages for specific fields
    
$valid->custom_err("email","Please enter a valid email.");
    
$valid->custom_err("password","At least 5 characcters are required.");
     
     
// set custom errors for validation functions
        
$valid->custom_err('alpha_chars',"field contains invalid characters.");
    
    
// now proceed to check your fields
    
$valid->check("password","required");
    
$valid->check("email","is_email|required");

    
// store results
    
$_SESION['failed_array'] = $valid->failed_array;
                
 
// if valid == true; connect and insert/update
     
if(count($valid->failed_array) < 1)
    {     
        echo 
"<b>Congratulations: you are currently signed in.</b>";
    }
}

?>

<style>
hr
{
    color:#CCC;
    height: 1px;
    margin-top:0px;
}
#topnav
{
    float: right;
}
</style>


<h1 style='color:#2F8B1E;font-family:arial;margin-bottom:0px;'>Sample SignIn </h1><hr />
 

 <span>Fields marked with(*) are required.</span>
<?php

//$error = $register->the_msg;

include("../forms/user_signin.php");
?>