Advertisement
DanielKoehler

Untitled

Nov 18th, 2013
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set('UTC');
  3. $ext = '.php';
  4. $path = realpath('./').'/application/model/';
  5.  
  6. require_once($path.'page'.$ext);
  7. require_once($path.'database'.$ext);
  8. require_once($path.'load'.$ext);
  9.  
  10. $path = realpath('./').'/application/controller/';
  11. $error = false;
  12. $controller = 'index';
  13. $method = 'index';
  14. $id =  null;
  15.  
  16. if(!empty($_GET['c'])){
  17.     $controller = $_GET['c'];
  18.     if(!empty($_GET['m'])){
  19.         $method = str_replace('-', '_', $_GET['m']);
  20.         if(!empty($_GET['id'])){
  21.             $id = $_GET['id'];
  22.         }
  23.     }
  24. }
  25.  
  26. if(file_exists($path.$controller.$ext)){
  27.     require_once($path.$controller.$ext);
  28.     if(class_exists($controller)){
  29.         $class = new $controller;
  30.         if(method_exists($class,$method)){
  31.                 $class->$method($id);
  32.         } else {
  33.             $error = true;
  34.         }
  35.     } else {
  36.         $error = true;
  37.     }
  38. } else {
  39.     $error = true;
  40. }
  41.  
  42. if($error === true){
  43.     echo '<h1>404 error: Page not found.</h1><p>Reason: ' . $auth_condition . '</p>';
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement