jesse_klaver

secured/index.php

May 29th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.71 KB | None | 0 0
  1. <?php
  2.     require_once 'autoloader.php';
  3.     if(!$_GET == null) { $rank  = $_GET["rank"];  } else { $rank  = 0; }
  4.     if(!$_GET == null) { $quote = $_GET["quote"]; } else { $quote = 0; }
  5.     if(!$_GET == null) { $login = $_GET["login"]; } else { $login = 0; }
  6.     session_start();
  7.     if(!isset($_SESSION['userId'])){
  8.         header("Location: ../index.php");
  9.     }
  10. ?>
  11. <!doctype html>
  12. <html lang="en">
  13. <head>
  14.     <meta charset="UTF-8">
  15.     <title>Secured!</title>
  16.     <link rel="stylesheet" href="../css/stylesheet.css" type="text/css">
  17. </head>
  18. <body>
  19.     <div class="signs">
  20.         <a href="../logOut.php"> <button>Logout</button> </a>
  21.     </div>
  22.     <div id="wrapper">
  23.         <div class="allQuote">
  24.             <?php
  25.                 if($quote >= 2) { ?>
  26.                     <table class="tbQuote">
  27.                         <tr>
  28.                             <th>Id</th>
  29.                             <th>Quote</th>
  30.                         </tr>
  31.                         <?php
  32.                         $aQuoteManager = new quoteManagers();
  33.                         $getAllQuotes = $aQuoteManager->getAll();
  34.                         if ($rank >= 2) {
  35.                             foreach ($getAllQuotes as $quotes) {
  36.                                 echo "<tr>";
  37.                                 echo "<td>$quotes->id</td>";
  38.                                 echo "<td>$quotes->quote</td>";
  39.                                 echo "<td><a href='delQuote.php?id=$quotes->id'>Del</a></td>";
  40.                                 echo "<td><a href='editQuote.php?id=$quotes->id'>Edit</a></td>";
  41.                                 echo "</tr>";
  42.                             }
  43.                         } else {
  44.                             foreach ($getAllQuotes as $quotes) {
  45.                                 echo "<tr>";
  46.                                 echo "<td>$quotes->id</td>";
  47.                                 echo "<td>$quotes->quote</td>";
  48.                                 echo "</tr>";
  49.                         } } ?>
  50.                     </table>
  51.                 <br/> <hr id="hr">
  52.             <?php } ?>
  53.         </div>
  54.  
  55.         <div class="allLogin">
  56.             <?php
  57.                 if($login >= 2) { ?>
  58.                     <table class="tbLogin">
  59.                         <tr>
  60.                             <th>Id</th>
  61.                             <th>Username</th>
  62.                             <th>Rank</th>
  63.                         </tr>
  64.                         <?php
  65.                         $aLoginManager = new loginManagers();
  66.                         $getAllLogins = $aLoginManager->getAll();
  67.                         if ($rank >= 2) {
  68.                             foreach ($getAllLogins as $login) {
  69.                                 echo "<tr>";
  70.                                 echo "<td>$login->id</td>";
  71.                                 echo "<td>$login->username</td>";
  72.                                 echo "<td>$login->rank</td>";
  73.                                 echo "<td><a href='delLogin.php?id=$login->id'>Del</a></td>";
  74.                                 echo "<td><a href='editLogin.php?id=$login->id'>Edit</a></td>";
  75.                                 echo "</tr>";
  76.                             }
  77.                         } else {
  78.                             foreach ($getAllLogins as $login) {
  79.                                 echo "<tr>";
  80.                                 echo "<td>$login->id</td>";
  81.                                 echo "<td>$login->username</td>";
  82.                                 echo "<td>$login->rank</td>";
  83.                                 echo "</tr>";
  84.                         } } ?>
  85.                     </table>
  86.                 <br/> <hr id="hr">
  87.             <?php } ?>
  88.         </div>
  89.     </div>
  90. </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment