Let’s see who can find it
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = "home";
}
$file = "templates/" . $page . ".php";
// I heard '..' is dangerous!
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");
// TODO: Make this look nice
assert("file_exists('$file')") or die("That file doesn't exist!");
?>
/*
HTML code here, nothing special, no logic...
*/
<div class="container" style="margin-top: 50px">
<?php
require_once $file;
?>
</div>