-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
46 lines (40 loc) · 986 Bytes
/
index.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
36
37
38
39
40
41
42
43
44
45
46
<?php
// ver: 1.0.20220619-0
require 'cache.php';
require 'url.php';
require 'errpage.php';
require 'config.php';
session_start();
if ($_POST) {
list($un, $pw) = $_POST;
if (!isset(USER[$un])) die('un');
if (USER[$un] !== $pw) die('pw');
$_SESSION['un'] = $un;
$_SESSION['pw'] = $pw;
die('hh');
}
if (
!isset($_SESSION['un']) ||
!isset(USER[$_SESSION['un']]) ||
USER[$_SESSION['un']] !== $_SESSION['pw']
) {
include('--file/login.html');
die();
}
list($file, $qry) = ScpoPHP\Url::rewrite_uriget();
$file = '--file/' . $file;
switch (true) {
case substr_compare($file, '.php', -4, 4) === 0:
if (!file_exists($file)) ScpoPHP\Errpage::die(404);
$_SERVER['QUERY_STRING'] = $qry;
parse_str($qry, $_GET);
chdir(substr($file, 0, strrpos($file, '/') + 1));
include($file);
die();
case substr_compare($file, '/', -1, 1) === 0:
$file .= 'index.html';
default:
if (!file_exists($file)) ScpoPHP\Errpage::die(404);
}
ScpoPHP\Cache::t_file($file);
include($file);