PHP Classes

File: examples/login.php

Recommend this page to a friend!
  Classes of Seth Carter   Secure Session Extended   examples/login.php   Download  
File: examples/login.php
Role: Example script
Content type: text/plain
Description: Setting a users fingerprint on login
Class: Secure Session Extended
Prevent session hijacking and fixation attacks
Author: By
Last change: Updated require file name
Date: 13 years ago
Size: 571 bytes
 

Contents

Class file image Download
<?php

// include either the PHP4 or PHP5 class
require_once("SecureSession.php5.class.php");
$Session = new SecureSession;

// Run your usual login methods from queries to a users db etc

if ($username == "User" && $passwd == "password") {
   
// All login info seems good, assign the user a unique fingerprint so they can roam the site / protected pages

   
$Session->SetFingerPrint();
   
$_SESSION['LoggedIn'] = true;

   
// Redirect user to your logged in area
   
header('Location: index.php');
    die();

} else {
    echo
"Wrong username or password";

}

?>