first commit
This commit is contained in:
27
session.php
Normal file
27
session.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Load .env
|
||||
$envFile = __DIR__ . '/.env';
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos($line, '=') !== false && strpos($line, '#') !== 0) {
|
||||
list($key, $value) = explode('=', $line, 2);
|
||||
$_ENV[trim($key)] = trim($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$level = isset($_SESSION["level"]) ? $_SESSION["level"] : '';
|
||||
$user_name = isset($_SESSION["name"]) ? $_SESSION["name"] : '';
|
||||
$user_id = isset($_SESSION["userid"]) ? $_SESSION["userid"] : '';
|
||||
$DB = isset($_SESSION["DB"]) ? $_SESSION["DB"] : 'chandj';
|
||||
|
||||
// Dynamic URL setup
|
||||
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? "https://" : "http://";
|
||||
$root_dir = $protocol . $_SERVER['HTTP_HOST'];
|
||||
$WebSite = $root_dir . '/';
|
||||
?>
|
||||
Reference in New Issue
Block a user