/**
  * Redirect to user homepage
  */
 public function actionHome()
 {
     if (!isset($_SESSION['user']) || $_SESSION['user'] == null) {
         SupportFunc::redirect("login.php?action=login");
     } else {
         SupportFunc::redirectByRole($_SESSION['user']['role']);
     }
 }
 /**
  * Call displaying method by requested 'page' 
  */
 public function __construct()
 {
     if (!isset($_SESSION['user']['role']) || $_SESSION['user']['role'] != 'user') {
         SupportFunc::redirect("login.php?action=login");
     }
     $this->user = new User($_SESSION['user']['email'], $_SESSION['user']['role']);
     if (file_exists('./logs/log_' . $_SESSION['user']['email'] . '.log')) {
         $file = file_get_contents('./logs/log_' . $_SESSION['user']['email'] . '.log', FILE_USE_INCLUDE_PATH);
         echo '<table width="700" border="1" cellpadding="4">';
         echo "<tr><td>" . nl2br($file) . "</td></tr>\n";
         echo '</table>';
     }
 }
 /**
  * Call displaying method by requested 'page' 
  */
 public function __construct()
 {
     if (!isset($_SESSION['user']['role']) || $_SESSION['user']['role'] != 'admin') {
         SupportFunc::redirect("login.php?action=login");
     }
     $directory = "logs/";
     $dir = opendir($directory);
     while (($file = readdir($dir)) !== false) {
         $filename = $directory . $file;
         $type = filetype($filename);
         if ($type == 'file') {
             $contents = file_get_contents($filename);
             $items = explode('¬', $contents);
             echo '<table width="700" border="1" cellpadding="4">';
             foreach ($items as $item) {
                 echo "<tr><td>" . nl2br($item) . "</td></tr>\n";
             }
             echo '</table>';
         }
     }
     closedir($dir);
 }
示例#4
0
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
require_once 'config.php';
SupportFunc::redirect('presents/view/login.php?action=login');
?>
    </body>
</html>