Everything previously under www/src now are under www/ Moved style.CSS under www/ressources, to allow blocking http requests to www/lib completly Moved <head> and <header> generation under lib/PHP/output/sections.php to reduce redundancy within files. Also implemented a system to allow them to generate relatif paht for href to ressources depending on their deepness within www/ hierarchy.
33 lines
1,004 B
PHP
33 lines
1,004 B
PHP
<?php
|
|
|
|
require_once 'update.php';
|
|
|
|
//The time after which an account must be regenerated.
|
|
define('ACCOUNT_REGENERATE_TIMER', 10*60);
|
|
// Time after which every request must be blocked for a running session.
|
|
define('ACCOUNT_EXPIRE_TIMER', ACCOUNT_REGENERATE_TIMER + 1*60);
|
|
|
|
// For permissions, use the user permissions through $_SESSION or
|
|
// use one of the ACCOUNT_PRIV_* const. from session/config.php
|
|
function start_new_session(
|
|
string $username,
|
|
string $displayname,
|
|
string $email,
|
|
string $permissions
|
|
): void
|
|
{
|
|
//Just checking if the user did have a session previously open.
|
|
if(isset($_SESSION["loggedin"]))
|
|
{
|
|
regenerate_current_session(true);
|
|
}
|
|
|
|
// SESSION VARIABLE ULTIMATE GUIDE !
|
|
$_SESSION["username"] = $username;
|
|
$_SESSION["displayname"] = $displayname;
|
|
$_SESSION["email"] = $email;
|
|
$_SESSION["permissions"] = $permissions;
|
|
$_SESSION["loggedin"] = true;
|
|
$_SESSION["REGENERATETIME"] = time() + ACCOUNT_REGENERATE_TIMER;
|
|
$_SESSION['EXPIRES'] = time() + ACCOUNT_EXPIRE_TIMER;
|
|
}
|