Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- session_start();
- include "header.php";
- $galleries_base_dir = "gallery";
- $default_gallery = "default_gallery";
- $pages_base_dir = "p";
- $default_page = "home";
- if(isset($_GET['page'])) {
- $page = $_GET['page'];
- } else {
- $page = $default_page;
- }
- switch($page) {
- case "gallery":
- if(isset($_GET['gallery'])) {
- $gallery = $_GET['gallery'];
- } else {
- $gallery = $default_gallery;
- }
- $gallery_path = "{$galleries_base_dir}/{$gallery}.php";
- include(get_page_to_load($gallery_path, "{$galleries_base_dir}/{$default_gallery}.php"));
- break;
- default:
- $page_path = "{$pages_base_dir}/{$page}.php";
- include(get_page_to_load($page_path, "{$pages_base_dir}/{$default_page}.php"));
- break;
- }
- function get_page_to_load($attempted_page, $default_page) {
- if($attempted_page != $default_page && file_exists($attempted_page)) {
- return $attempted_page;
- } else {
- return $default_page;
- }
- }
- include "footer.php";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement