×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Андрей Зайцев
Added: Jan 29, 2017 5:38 AM
Views: 10
Tags: no tags
  1. <?php
  2.  
  3. if ($_SERVER['REQUEST_URI'] == '/') {
  4.     $page = 'home';
  5. } else {
  6.  
  7.     $page = substr($_SERVER['REQUEST_URI'], 1);
  8.  
  9.     if (!preg_match('/^[A-z0-9]{3,15}$/', $page)) {
  10.         exit('error url');
  11.     }
  12. }
  13.  
  14.  
  15.  
  16.  
  17.  
  18. if (file_exists('/all/' . $page . '.php')) {
  19.     include '/all/' . $page . '.php';
  20. } else if ($_SESSON['ulogin'] == 1 and file_exists('/auth/' . $page . '.php')) {
  21.     include 'auth/' . $page . '.php';
  22. } else if ($_SESSON['ulogin'] != 1 and file_exists('/guest/' . $page . '.php')) {
  23.     include 'guest/' . $page . '.php';
  24. } else {
  25.     exit('Страница 404');
  26. }
  27.  
  28. function top( $title ) {
  29.  
  30. echo '<!DOCTYPE html>
  31. <html lang="ru">
  32. <head>
  33. <meta charset="UTF-8">
  34. <link rel="stylesheet" href="css/style.css">
  35. <title>'.$title.'</title>
  36.  
  37. </head>
  38.  
  39. <body>
  40. <div class= "wrapper">
  41.  
  42.  
  43.  
  44.           require_once "kontent/header.php";
  45.           require_once "kontent/nav-menu.php";
  46.           require_once "kontent/header.php";
  47.           require_once "kontent/content.php";
  48.           require_once "kontent/foter.php";
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. ';
  58. }
  59.  
  60.  
  61.  
  62. function bottom() {
  63. echo '
  64.  
  65. </div>
  66. </body>
  67. </html>';
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ?>
  76.