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