A simple php website which displays quotes on pictures of pandas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.4 KiB

  1. <?php
  2. //11-24-16
  3. $loggedIn = false;
  4. $admin = false;
  5. session_start();
  6. ob_start();
  7. require_once("../quotes_connect.php");
  8. if((md5($_SERVER['HTTP_USERAGENT'] . 'salt')) ==
  9. ($_SESSION['agent']) && $_SESSION['use'] == true)
  10. {
  11. $loggedIn = true;
  12. //checks to see if user is an admin
  13. $q = "select admin from users where user_name='" .
  14. $_SESSION['username'] . "'";
  15. $r = mysqli_query($dbc, $q);
  16. if(@mysqli_num_rows($r) == 1)
  17. {
  18. while($row = mysqli_fetch_array($r))
  19. {
  20. $checka = $row['admin'];
  21. }
  22. if($checka)
  23. {
  24. $admin = true;
  25. }
  26. }
  27. }
  28. if($admin)
  29. {
  30. echo '<!DOCTYPE html>
  31. <html>
  32. <title>Panda Quotes</title>
  33. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" > </script>
  34. <meta name="viewport" content="width=device-width, initial-scale=1">
  35. <link rel="stylesheet" href="includes/w3.css">
  36. <link rel="stylesheet" href="http://www.w3schools.com/lib/w3-theme-black.css">
  37. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
  38. <body>
  39. <!-- Header -->
  40. <header class="w3-container w3-theme w3-padding" id="myHeader">
  41. <div class="w3-center">
  42. <h1 class="w3-xxxlarge w3-animate-bottom">Panda Quotes</h1>
  43. <ul class="w3-navbar w3-theme">
  44. <li><a class="w3-dark-grey w3-padding-16" href="index.php">Home</a></li>
  45. <li><a class="w3-padding-16" href="quotes.php">Add Quote</a></li>
  46. <li><a class="w3-padding-16" href="admin.php">Admin</a></li>
  47. </ul>
  48. </div>
  49. </header>';
  50. }
  51. elseif($loggedIn)
  52. {
  53. echo '<!DOCTYPE html>
  54. <html>
  55. <title>Panda Quotes</title>
  56. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" > </script>
  57. <meta name="viewport" content="width=device-width, initial-scale=1">
  58. <link rel="stylesheet" href="includes/w3.css">
  59. <link rel="stylesheet" href="http://www.w3schools.com/lib/w3-theme-black.css">
  60. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
  61. <body>
  62. <!-- Header -->
  63. <header class="w3-container w3-theme w3-padding" id="myHeader">
  64. <div class="w3-center">
  65. <h1 class="w3-xxxlarge w3-animate-bottom">Panda Quotes</h1>
  66. <ul class="w3-navbar w3-theme">
  67. <li><a class="w3-dark-grey w3-padding-16" href="index.php">Home</a></li>
  68. <li><a class="w3-padding-16" href="quotes.php">Add Quote</a></li>
  69. </ul>
  70. </div>
  71. </header>';
  72. }
  73. else
  74. {
  75. echo '<!DOCTYPE html>
  76. <html>
  77. <title>Panda Quotes</title>
  78. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" > </script>
  79. <meta name="viewport" content="width=device-width, initial-scale=1">
  80. <link rel="stylesheet" href="includes/w3.css">
  81. <link rel="stylesheet" href="http://www.w3schools.com/lib/w3-theme-black.css">
  82. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
  83. <body>
  84. <!-- Header -->
  85. <header class="w3-container w3-theme w3-padding" id="myHeader">
  86. <div class="w3-center">
  87. <h1 class="w3-xxxlarge w3-animate-bottom">Panda Quotes</h1>
  88. <ul class="w3-navbar w3-theme">
  89. <li><a class="w3-dark-grey w3-padding-16" href="index.php">Home</a></li>
  90. </ul>
  91. </div>
  92. </header>';
  93. }