-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-redirect.php
35 lines (34 loc) · 1.12 KB
/
post-redirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include("config.php");
include("src/functions.php");
/**
* A processing page that does a redirect.
*/
if ($_POST["send"] ?? false) {
if ($_POST["sendingpage"] == "login") {
$userForm = htmlentities($_POST["user"] ?? null);
$passForm = htmlentities($_POST["pass"] ?? null);
checkUserCredentials($dsn_credentials, $userForm, $passForm);
if (!($_SESSION["logedin"])) {
$_SESSION['error_message'] = 'Wrong credentials! Try again.';
}
$url = "admin.php";
}
}
if ($_GET["send"] ?? false) {
if ($_GET["send"] == "admin") {
if ($_GET['action'] == 'init') {
$pattern = '/(.*)\.[^.]+$/';
// preg_match($pattern, $_SESSION['database'], $db_striped);
$db_path = __DIR__ . "/db/{$_SESSION['database']}";
//echo "sqlite3 {$db_path}.sqlite < {$db_path}.sql";
//exit();
exec("sqlite3 {$db_path}.sqlite < {$db_path}.sqlite.sql");
$url = "post-admin.php?admin-action=init";
}
}
}
$url = $url ?? 'unknown-sender.php';
// Redirect to a result page.
header("Location: $url");
exit();