Advertisement
Guest User

Untitled

a guest
Aug 11th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $action = $_GET['action'];
  4. if ($action) {
  5. if ($action == 'login') {
  6. if (empty($_POST['username']) || empty($_POST['password'])) {
  7. die('Username or password left blank!');
  8. } else {
  9. $_SESSION['LOGIN'] = TRUE;
  10. $_SESSION['USER'] = $_POST['username'];
  11. $_SESSION['PASS'] = $_POST['password'];
  12. }
  13. } elseif ($action == 'register') {
  14. if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])) {
  15. die('Username, password, or e-mail left blank!');
  16. } else {
  17. $_SESSION['LOGIN'] = TRUE;
  18. $_SESSION['USER'] = $_POST['username'];
  19. $_SESSION['PASS'] = $_POST['password'];
  20. $_SESSION['EMAIL'] = $_POST['email'];
  21. }
  22. } elseif ($action == 'logout') {
  23. $_SESSION['LOGIN'] = FALSE;
  24. $_SESSION['USER'] = NULL;
  25. $_SESSION['PASS'] = NULL;
  26. $_SESSION['EMAIL'] = NULL;
  27. die('Successfully logged out! <a href="index.php">Back.</a>);')
  28. }
  29. }
  30. ?>
  31. <html>
  32. <head>
  33. <title>Beluga Whale Exhibit</title>
  34. </head>
  35. <body>
  36. <h1 style="color:aqua;">The Beluga Whale Exhibit</h1>
  37. <?php if ($_SESSION['LOGIN'] == TRUE) { ?>
  38. <h2><b>Welcome back, <?php echo $_SESSION['USER']; ?></b></h2>
  39. <?php } ?>
  40. <p style="color:aqua;font-size:30px;">Special Access allowed to, Alexa Pedrero Barron, Ran Asher Peer, and Jack Thomas Holiman.<br>
  41. The star of this exhibit, Alexa, is known to be one of the first Beluga Whales. It is known that the whale is said to be 56,000 years old.<br>
  42. Wow! You learn something new every day :)<br></p>
  43. <p><a href="http://twitter.com/ale4175">Visit the whale's Twitter page! Or just click on the picture for a direct link!</a><br></p>
  44. <p><a href="http://twitter.com/JackHoliman">Visit Jack's Twitter page! Or just click on the picture for a direct link!</a><br></p>
  45. <p><a href="http://twitter.com/Ran_Peer">Visit Ran's Twitter page! Or just click on the picture for a direct link!</a><br></p>
  46. <style>
  47. .whales {
  48. display:inline;
  49. border:7px solid aqua;
  50. }
  51.  
  52. .whales:hover {
  53. border:7px dotted red;
  54. }
  55. </style>
  56. <?php if ($_SESSION['LOGIN'] == TRUE) { ?><a href="http://twitter.com/ale4175"><?php } ?><img src="https://i.gyazo.com/cfed12973de79589ac2c6dd387212a51.png" class="whales" height="400px" width="400px"></a>
  57. <?php if ($_SESSION['LOGIN'] == TRUE) { ?><a href="https://twitter.com/bhambeluga"><?php } ?><img src="https://i.gyazo.com/7ebc2f68b5194ff9a91286073d2cb617.png" class="whales" height="400" width="400px"></a>
  58. <?php if ($_SESSION['LOGIN'] == TRUE) { ?><a href="http://twitter.com/JackHoliman"><?php } ?><img src="https://pbs.twimg.com/profile_images/739329178676273156/42bD_QZ7.jpg" class="whales" height="400px" width="400px"></a>
  59. <?php if ($_SESSION['LOGIN'] == TRUE) { ?><a href="http://twitter.com/Ran_Peer"><?php } ?><img src="https://pbs.twimg.com/profile_images/750178410123567104/Y9B3dcu5.jpg" class="whales" height="400px width=" 400px=""></a>
  60. <br><br>
  61. <?php if ($_SESSION['LOGIN'] == FALSE) { ?>
  62. <h2>Login to the beluga whale exhibit!</h2>
  63. <form action="?action=login" method="POST">
  64. <label for="username">Username : </label><input type="text" name="username"><br>
  65. <label for="password">Password : </label><input type="password" name="password"><br><br>
  66. <input type="submit" value="Login">
  67. </form>
  68. <?php } else { ?>
  69. <a href="?action=logout"><button>Logout</button></a>
  70. <?php } ?>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement