Created
December 2, 2017 21:06
-
-
Save pawelwch/848c5d3f4c6d0a54b49a1e181b57061c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<?php | |
if (isset($_GET['page'])) | |
{ | |
$allowed_pages = array("java", "php", "mysql"); | |
$page = filter_var($_GET['page'], FILTER_SANITIZE_STRING); | |
if (!empty($page)) | |
{ | |
if (!in_array($page, $allowed_pages)) | |
{ | |
if (is_file($page.".html")) | |
include ($page.".html"); | |
} | |
} | |
} | |
else | |
include ("start.php"); | |
echo $title; | |
?> | |
<link rel="stylesheet" href="style.css" type="text/css" /> | |
<script type="text/javascript" src="jsc.js"></script> | |
</head> | |
<body> | |
<div id="container"> | |
<div id="top"> | |
<h1>TOP</h1> | |
</div> | |
<div id="menu"> | |
<div><a href="?page=java">Java</a></div> | |
<div><a href="?page=php">PHP</a></div> | |
<div><a href="?page=mysql">MySql</a></div> | |
</div> | |
<div id="content"> | |
<div id="text"> | |
<?php | |
if (isset($_GET['page'])) | |
{ | |
$allowed_pages = array("java", "php", "mysql"); | |
$page = filter_var($_GET['page'], FILTER_SANITIZE_STRING); | |
if (!empty($page)) | |
{ | |
if (!in_array($page, $allowed_pages)) | |
echo "Taka strona nie istnieje"; | |
else | |
{ | |
if (is_file($page.".html")) | |
include ($page.".html"); | |
else | |
echo "Taka strona nie istnieje"; | |
} | |
} | |
} | |
else | |
include("start.html"); | |
?> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
<?php | |
$title = "<title>PHP - zmienna predefiniowana \$_GET</title>"; | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment