7 languages, 3 pages (What/How/Start), 80-line router, 98KB total.
Features:
- No database, no Composer, no build step — just files on disk
- nginx PHP isolation: only index.php executes
- Bot detection with browser heuristic bypass
- Rate limiting, structured weekly logs, geo-location, Telegram alerts
- Multi-language: Accept-Language auto-detect, nav dropdown
- Article sub-page routing via /start/{slug}
- Apache + Caddy config alternatives documented in Start page
- Sample config — no real keys or secrets
63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
PHP
<?php
|
|
loadLanguage();
|
|
|
|
$slugs = [PAGE_00_SLUG, PAGE_01_SLUG, PAGE_02_SLUG, PAGE_03_SLUG, PAGE_04_SLUG, PAGE_05_SLUG];
|
|
|
|
if (!empty($PARAMS['1'])) {
|
|
$slug = $PARAMS['1'];
|
|
|
|
if (in_array($slug, $slugs, true)) {
|
|
$_SESSION['SITE']['slug'] = $slug;
|
|
include(__ROOT__.'/app/view/_header.phtml');
|
|
if ($slug === PAGE_02_SLUG && !empty($PARAMS['2'])) {
|
|
$article = basename($PARAMS['2']);
|
|
include(__ROOT__.'/lng/'.$_SESSION['SITE']['language'].'/'.$_SESSION['SITE']['slug'].'/'.$article.'.phtml');
|
|
} else {
|
|
include(__ROOT__.'/lng/'.$_SESSION['SITE']['language'].'/'.$_SESSION['SITE']['slug'].'.phtml');
|
|
}
|
|
include(__ROOT__.'/app/view/_footer.phtml');
|
|
|
|
} elseif ($slug === 'error') {
|
|
if (!empty($PARAMS['2'])) {
|
|
$errorCode = $PARAMS['2'];
|
|
$_SESSION = array();
|
|
include(__ROOT__.'/app/view/_header.phtml');
|
|
include(__ROOT__.'/app/view/_error.phtml');
|
|
include(__ROOT__.'/app/view/_footer.phtml');
|
|
} else {
|
|
header('Location: '.__URL__.'error/404');
|
|
exit;
|
|
}
|
|
|
|
} elseif ($slug === 'dev') {
|
|
if (!DEBUG) { header('Location: '.__URL__); exit; }
|
|
echo '<center><h1>Development</h1></center>';
|
|
include(__ROOT__.'/app/view/_dev.php');
|
|
|
|
} elseif ($slug === 'clear') {
|
|
$_SESSION = array();
|
|
header('Location: '.__URL__);
|
|
exit;
|
|
|
|
} elseif ($slug === 'set') {
|
|
$supported = array_keys(LANGUAGES);
|
|
if (!empty($PARAMS['2']) && in_array($PARAMS['2'], $supported, true)) {
|
|
$_SESSION['SITE']['language'] = $PARAMS['2'];
|
|
header('Location: '.__URL__.$_SESSION['SITE']['slug']);
|
|
} else {
|
|
$_SESSION = array();
|
|
header('Location: '.__URL__);
|
|
}
|
|
exit;
|
|
|
|
} else {
|
|
header('Location: '.__URL__.'error/404');
|
|
exit;
|
|
}
|
|
|
|
} else {
|
|
$_SESSION['SITE']['slug'] = PAGE_00_SLUG;
|
|
include(__ROOT__.'/app/view/_header.phtml');
|
|
include(__ROOT__.'/lng/'.$_SESSION['SITE']['language'].'/'.$_SESSION['SITE']['slug'].'.phtml');
|
|
include(__ROOT__.'/app/view/_footer.phtml');
|
|
}
|