Advertisement
darryljf

index.php - latest

Mar 31st, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors', 1); // function script allows a script to temporarily override a setting in PHP congif file - display errprs set to on, represented by 1
  4. ini_set('display_startup_errors', 1); // set to true with 1 to display to override and display the errors
  5. error_reporting(E_ALL & ~E_NOTICE); // report all errors except E_NOTICE
  6.  
  7. require_once(__DIR__.'/includes/boot.include.php');
  8. require_once(__DIR__.'/classes/user.class.php');
  9.  
  10.  
  11.  
  12. if($_GET['p']){ // check if a page is requested and assign smarty to display the requested view
  13.  
  14.   $_SESSION['user_data'] = $user_data;
  15.  
  16.   // array which stores which pages should be secure
  17.   $secure_pages = array('account','my_crate','changepassword', 'search_db', 'wantlist');
  18.  
  19.   //check if page being requested by the user is in the array
  20.   if(in_array($_GET['p'], $secure_pages)){
  21.       // if page being requested is in the array check if the user is logged in
  22.       if(!$_SESSION['is_loggedin']) {
  23.         header("Location: index.php?p=login");
  24.         exit();
  25.       }
  26.   }
  27.  
  28.   $smarty->assign('view_name',$_GET['p']);
  29.   require_once('controllers/'.$_GET['p'].'.php');
  30.   $smarty->display('pages/'.$_GET['p'].'.tpl');
  31. }else{
  32.   $smarty->assign('view_name', 'login');
  33.   require_once('controllers/login.php');
  34.   $smarty->display('pages/login.tpl');
  35. }
  36.  
  37.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement