v4 added, php boilerplate added

This commit is contained in:
Filip Rojek 2023-02-27 13:15:43 +01:00
parent cf4f7fd9ba
commit 50f196849b
6 changed files with 114 additions and 0 deletions

9
v4/.htaccess Normal file
View File

@ -0,0 +1,9 @@
RewriteEngine On
Options -Indexes
RewriteBase /
# index.php?page=neco => neco/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ ?page=$1

0
v4/Dockerfile Normal file
View File

12
v4/css/style.css Normal file
View File

@ -0,0 +1,12 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.nav {
display: flex;
}

88
v4/index.php Normal file
View File

@ -0,0 +1,88 @@
<?php
session_start();
$prod = false;
// Display Errors
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
// Display var_dump
#var_dump($_SESSION);
// Date Time Zone
date_default_timezone_set('Europe/Prague');
// site info
$keywords = "";
$description = "";
$locale = "cs_CZ";
$title = "";
$site_name = "";
$author = "Fofrweb | https://fofrweb.com";
$email = "webmaster(@)fofrweb.com";
$canonical = "https://";
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1.0" />
<meta id="contentLanguage" http-equiv="Content-Language" content="<?= $locale ?>" />
<meta name="keywords" content="<?= $keywords ?>" />
<meta name="description" content="<?= $description ?>" />
<meta property="og:locale" content="<?= $locale ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?= $title ?>" />
<meta property="og:description" content="<?= $description ?>" />
<meta property="og:site_name" content="<?= $site_name ?>" />
<meta name="author" content="<?= $author ?>" />
<meta name="email" content="<?= $email ?>" />
<meta name="copyright" content="<?= $copyright ?>" />
<meta name="expires" content="never" />
<?php
if($prod) { ?>
<meta name="robots" content="index,follow" />
<meta name="Seznambot" content="index,follow" />
<meta name="Googlebot" content="index,follow" />
<?php } else { ?>
<meta name="robots" content="noindex, nofollow" />
<meta name="Seznambot" content="noindex, nofollow" />
<meta name="Googlebot" content="noindex, nofollow" />
<?php } ?>
<title><?= $title ?></title>
<link rel="canonical" href="<?= $canonical ?>" />
</head>
<body>
<?php
if(isset($_GET['page'])) {
$file = $_GET['page'];
$file2 = dirname($_SERVER['SCRIPT_FILENAME']) . "/pages/$file/$file.php";
echo $file2;
if(file_exists($file2)) {
if(substr_count($file, "../") > 0) {
echo("<h3>Upozornění</h3> Nelze nahrát soubor v nadřazeném adresáři.");
}
elseif($file == "index" || $file == "/index") {
echo("<h3>Upozornění</h3> Index nemůže načíst sám sebe.");
} else {
require_once($file2);
}
}
else {
require_once("./pages/error_404.php");
}
}
else {
require_once("./pages/home/home.php");
}
?>
</body>
</html>

2
v4/pages/home/home.php Normal file
View File

@ -0,0 +1,2 @@
<h3>Home</h3>
<a href="/?page=test">test</p>

3
v4/pages/test/test.php Normal file
View File

@ -0,0 +1,3 @@
<h3>Test</h3>
<a href="/?page=home">home</a>