feat: add even more vulnerabilities! migrate to mysql

This commit is contained in:
2025-06-05 21:25:40 +03:00
parent 11b7696c19
commit 5bea4d52cb
10 changed files with 236 additions and 53 deletions

View File

@ -5,15 +5,13 @@ $request = $_SERVER['REQUEST_URI'];
$path = parse_url($request, PHP_URL_PATH);
if (isset($_COOKIE["user_id"])) {
error_log('cookie is set', 0);
/* error_log('cookie is set', 0); */
} else {
error_log('cookie is NOT set', 0);
/* error_log('cookie is NOT set', 0); */
$ids = initializeApp(null);
setcookie("user_id", $ids["user_id"], time() + 3600, "/");
setcookie("db_file", $ids["db_file"], time() + 3600, "/");
$_COOKIE["user_id"] = $ids["user_id"];
$_COOKIE["db_file"] = $ids["db_file"];
}
/* TODO: remove for prod code */
@ -26,24 +24,15 @@ if ($extension === 'css') {
}
/* TODO: remove for prod code */
switch($path) {
case '': case '/': case '/products':
require __DIR__.'/products.php';
break;
case '/login':
require __DIR__.'/login.php';
break;
case '/register':
require __DIR__.'/register.php';
break;
case '/logout':
require __DIR__.'/logout.php';
break;
case '/orders':
require __DIR__.'/orders.php';
break;
case '/users':
require __DIR__.'/users.php';
break;
}
$page = match($path) {
'', '/', '/products' => '/products.php',
'/login' => '/login.php',
'/register' => '/register.php',
'/logout' => '/logout.php',
'/orders' => '/orders.php',
'/users' => '/users.php',
default => '/404.php',
};
require __DIR__.$page;
?>