PHP Classes

File: Login.php

Recommend this page to a friend!
  Packages of Ramesh Narayan Jangid (Sharma)   Session Handlers Collection   Login.php   Download  
File: Login.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Session Handlers Collection
Store PHP sessions in different types of storage
Author: By
Last change: Refactoring
Date: 7 months ago
Size: 638 bytes
 

Contents

Class file image Download
<?php

require_once __DIR__ . '/AutoloadSessionHandler.php'; // phpcs:ignore

use CustomSessionHandler\Session;

// Turn on output buffering
ob_start();

// Initialize Session Handler
Session::initSessionHandler(sessionMode: 'File');

if (isset(
$POST['submit'])) {
   
$username = $POST['username'];
   
$password = $POST['password'];
    if (
verifyCredentials($username, $password)) { // phpcs:ignore
       
$userDetails = getFromDB($username);

       
// Start session in normal (read/write) mode.
       
Session::sessionStartReadWrite();
       
$_SESSION = $userDetails;

       
header(header: 'Location: dashboard.php');
    }
}