Author: Admin 07/27/2022
Language:
PHP
Tags: session php
Here's how I start and setup a session for a PHP app.
Here's how I setup a session with its default values on page load.
//Start session
if(session_id() == ''){
session_start();
}
//Setup session
if (!isset($_SESSION['$SessData']['Skip'])){
$_SESSION['$SessData']['Skip'] = true;
$_SESSION['$SessData']['sql'] = explode('|',$app->getSQL());
$_SESSION['$SessData']['NewIndex'] = 0;
$_SESSION['$SessData']['days'] = 0;
$_SESSION['$SessData']['daysTotal'] = 0;
$_SESSION['$SessData']['day'] = 0;
$_SESSION['$SessData']['Status'] = 0;
$_SESSION['$SessData']['Tried'] = '';
}
//Set a value
$_SESSION['$SessData']['Status'] = 1;
//Read a value
echo $_SESSION['$SessData']['Status'][0]