Login   Register  
PHP Classes
elePHPant
Icontem

File: process.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nitesh Apte  >  Login System  >  process.php  >  Download  
File: process.php
Role: Application script
Content type: text/plain
Description: Processing Page
Class: Login System
Authenticate users with records in a database
Author: By
Last change:
Date: 4 years ago
Size: 1,187 bytes
 

Contents

Class file image Download
<?php
if (isset($_REQUEST['action'])) 
{
    switch (
$_REQUEST['action']) 
    {
        case 
'Sign In':
            if(((
$_POST['u_email']=="") and ($_POST['u_pass']=="")) or (($_POST['u_email']=="") or ($_POST['u_pass']=="")))
            {
                
header("Location: index.php?empty");
                exit();
            }
            if(!
preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,3})$/"$_POST['u_email']))
            {
                
header('Location: index.php?wrong');
                exit();
            }
            else 
            {
                
$Email htmlspecialchars($_POST['u_email']);
                
$Pass htmlspecialchars($_POST['u_pass']);

                try {
                    require 
'core/class.userprofile.php';    
                    
$obj = new UserProfile();
                    if(
$obj->_makeConnection()->_selectDB()->_userLogin($Email$Pass))
                    {
                        
header('Location: welcome.php');
                        exit();
                    }
                    else
                    {
                        
header('Location: index.php');
                        exit();
                    }
                }
                catch(
Exception $e) {
                    echo 
$e->getMessage();
                }
            }
            break;

        case 
'Logout':
            try {
                require 
'core/class.userprofile.php';    
                
UserProfile::_userLogout();
            }
            catch(
Exception $e) {
                echo 
$e->getMessage();
            }
            break;
        }
}
?>