Login   Register  
PHP Classes
elePHPant
Icontem

File: phpsecureweb/login.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bulent Tezcan  >  phpsecureweb  >  phpsecureweb/login.php  >  Download  
File: phpsecureweb/login.php
Role: Application script
Content type: text/plain
Description: deals with login
Class: phpsecureweb
Allow users certain rights, login with password.
Author: By
Last change:
Date: 2002-10-29 04:29
Size: 1,287 bytes
 

Contents

Class file image Download
<?php
    
/*
    * @author Bulent Tezcan. bulent@greenpepper.ca
    */

    
require_once "Security.class.php";
    
    
session_start( );

    
ob_start( );

    include 
"header.inc.php";

    if (
$_GET['mode'] == 'logout')
    {
        
$_SESSION['myAccount'] = null;
        
$_SESSION['myHierarchy'] = null;
    }

    
$mySecurity = new Security( );

    if (
$_GET['mode'] == 'logout')
    {
        
$mySecurity-> GotoThisPageGOTO_PAGE_AFTER_LOGOUT );
    }

    
$FormElements $_POST["form_login"];

    
$FormElements['__error'] = "";
    
    if (
$FormElements['username'] == "" or 
            
$FormElements['password'] == "")
            
$FormElements['__error'] = "Please enter username and password";
    else
    {
        if (!
$mySecurity-> VerifyUser($FormElements['username'], 
                                                                    
$FormElements['password']))
            
$FormElements['__error'] = $mySecurity-> GetErrorMessage( );
        else
        {
            
$_SESSION['myAccount']    = $mySecurity-> GetAccountID( );
            
$_SESSION['myHierarchy']= $mySecurity-> GetHierarchy( );
            
            
$mySecurity-> SuccessfulLogin( );
        }
    }


    if (
$FormElements['__error'] == "")
    {
        
$_SESSION['loginPrompting'] = null;
        
header("Location: ".$_SESSION['http_referer']);
        exit;
    }

    
$mySecurity-> PromptLogin($FormElements);

    include 
"footer.inc.php";

    
ob_end_flush( );

    return 
true;

?>