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
31 lines
1.9 KiB
PHTML
31 lines
1.9 KiB
PHTML
<section class="content-section">
|
|
<h2 class="section-title">How It Works</h2>
|
|
<div class="section-content">
|
|
|
|
<h3>Request Flow</h3>
|
|
<p>Every request hits <code>index.php</code>. That's the only PHP file nginx allows to execute — everything else returns 404. From there:</p>
|
|
<pre style="background:#f5f5f5;padding:1rem;border-radius:6px;font-size:0.9rem;">Browser → nginx → index.php
|
|
├── POST/GET form? → app/controler/request.php
|
|
└── Clean URL? → app/controler/start.php → match slug → page</pre>
|
|
|
|
<h3>Routing</h3>
|
|
<p>URLs are mapped to page templates via slug constants in <code>class/config.php</code>:</p>
|
|
<pre style="background:#f5f5f5;padding:1rem;border-radius:6px;font-size:0.9rem;">define('PAGE_00_SLUG','home'); // → /home
|
|
define('PAGE_01_SLUG','about'); // → /about
|
|
define('PAGE_02_SLUG','start'); // → /start</pre>
|
|
<p>Add a new page: define the slug in config, add menu text in <code>lng/{lang}/menu.php</code>, create the template in <code>lng/{lang}/{slug}.phtml</code>. Done.</p>
|
|
|
|
<h3>Languages</h3>
|
|
<p>Multi-language support is file-based. Each language gets its own directory under <code>lng/</code> with a <code>menu.php</code> (navigation text + error messages) and <code>.phtml</code> templates for each page. Browser <code>Accept-Language</code> header auto-detects the language. Users can switch via the nav dropdown.</p>
|
|
|
|
<h3>Security (no config required)</h3>
|
|
<ul>
|
|
<li>nginx blocks all <code>.php</code> except <code>index.php</code></li>
|
|
<li>Session cookies: httponly, SameSite=Lax, strict_mode</li>
|
|
<li>Input sanitized via <code>FILTER_SANITIZE_FULL_SPECIAL_CHARS</code></li>
|
|
<li>Bot detection: 30+ UA patterns + browser heuristic bypass</li>
|
|
<li>Rate limiting: blocks at 5 req/s per session</li>
|
|
<li>Path traversal protection via <code>basename()</code></li>
|
|
</ul>
|
|
</div>
|
|
</section>
|