Fix RUNTIME array being reset after loading config
parent
06b7e6dc6e
commit
3134f55393
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
date_default_timezone_set("Europe/Berlin");
|
date_default_timezone_set("Europe/Berlin");
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
include_once("config.php");
|
||||||
|
|
||||||
session_set_cookie_params([
|
session_set_cookie_params([
|
||||||
'lifetime' => 86400,
|
'lifetime' => 86400,
|
||||||
|
@ -12,7 +13,7 @@ session_set_cookie_params([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
if(!isset($_SESSION['csrf']) || strlen($_SESSION['csrf'] != 64)) {
|
if(!isset($_SESSION['csrf']) || strlen($_SESSION['csrf']) != 64) {
|
||||||
$_SESSION['csrf'] = bin2hex(random_bytes(32));
|
$_SESSION['csrf'] = bin2hex(random_bytes(32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +26,10 @@ include_once("classen/GoogleAuthenticator.php");
|
||||||
include_once("classen/OpenSim.php");
|
include_once("classen/OpenSim.php");
|
||||||
include_once("classen/discord.php");
|
include_once("classen/discord.php");
|
||||||
|
|
||||||
$RUNTIME = array();
|
|
||||||
$RUNTIME['OPENSIM'] = new OpenSim();
|
$RUNTIME['OPENSIM'] = new OpenSim();
|
||||||
|
|
||||||
include_once("config.php");
|
|
||||||
|
|
||||||
function isValidEndpoint(string $pageName, string $dirPrefix) {
|
function isValidEndpoint(string $pageName, string $dirPrefix) {
|
||||||
return preg_match("[a-zA-Z0-9\.]{1,100}", $pageName) && file_exists("./".$dirPrefix."/".$pageName.".php");
|
return preg_match("/[a-zA-Z0-9\.]{1,100}/", $pageName) && file_exists("./".$dirPrefix."/".$pageName.".php");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: add API keys and/or rate limiting
|
//TODO: add API keys and/or rate limiting
|
||||||
|
|
Loading…
Reference in New Issue