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: 6 years ago
Size: 571 bytes


Class file image Download

// include either the PHP4 or PHP5 class
$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['LoggedIn'] = true;

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

} else {
"Wrong username or password";