PHP Classes

File: phpsecureweb/login.php

Recommend this page to a friend!
  Classes of Bulent Tezcan   phpsecureweb   ???   Download  
File: phpsecureweb/???
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: 22 years ago
Size: 1,287 bytes
 

Contents

Class file image Download
<?php
   
/*
    * @author Bulent Tezcan. [email protected]
    */

   
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-> GotoThisPage( GOTO_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;

?>