Guest User

My PHP Code

a guest
Jul 12th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2. // Initialize the session
  3. session_start();
  4.  
  5. // Check if the user is logged in, if not then redirect him to login page
  6. if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
  7. header("location: login.php");
  8. exit;
  9. }
  10.  
  11. ?>
  12.  
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <meta charset="UTF-8">
  17. <title>Welcome</title>
  18. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
  19. <style type="text/css">
  20. body{ font: 14px sans-serif; text-align: center; }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="page-header">
  25. <h1>Hi, <b><?php echo htmlspecialchars($_SESSION["username"]); ?></b>. Welcome to our site.</h1>
  26. </div>
  27. <p>
  28. <?php echo "Your rank is currently" . $_SESSION["user_type_value"]; ?>
  29. <br />
  30. <br />
  31. <a href="reset-password.php" class="btn btn-warning">Reset Your Password</a>
  32. <a href="logout.php" class="btn btn-danger">Sign Out of Your Account</a>
  33. </p>
  34. </body>
  35. </html>
Add Comment
Please, Sign In to add comment