1
0
Fork 0

Fix RUNTIME array being reset after loading config

master
Anonymous Contributor 2023-08-23 18:16:34 +02:00
parent 06b7e6dc6e
commit 3134f55393
1 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,7 @@
<?php
date_default_timezone_set("Europe/Berlin");
error_reporting(E_ALL);
include_once("config.php");
session_set_cookie_params([
'lifetime' => 86400,
@ -12,7 +13,7 @@ session_set_cookie_params([
]);
session_start();
if(!isset($_SESSION['csrf']) || strlen($_SESSION['csrf'] != 64)) {
if(!isset($_SESSION['csrf']) || strlen($_SESSION['csrf']) != 64) {
$_SESSION['csrf'] = bin2hex(random_bytes(32));
}
@ -25,13 +26,10 @@ include_once("classen/GoogleAuthenticator.php");
include_once("classen/OpenSim.php");
include_once("classen/discord.php");
$RUNTIME = array();
$RUNTIME['OPENSIM'] = new OpenSim();
include_once("config.php");
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