Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // check_age.php
  2. <?php
  3. session_start();
  4. if (isset($_POST['submit'], $_POST['adult']) && $_POST['adult'] == 1) {
  5.     $_SESSION['adult'] = 'true';
  6.     header ('location: index.php');
  7. }
  8. ?>
  9. <html>
  10. <head></head>
  11. <body>
  12. <form action="" method="POST">
  13. <input type="checkbox" name="adult" value="1">
  14. I am over 21 years old
  15. <input type="submit" name="submit">
  16. </form>
  17. </body>
  18. </html>
  19.  
  20. // has_age.php
  21. <?php
  22. session_start();
  23. if (!isset($_SESSION['adult'])) {
  24. header('location: check_age.php');
  25. }
  26. ?>
  27.  
  28. // index.php
  29.  
  30. // first line
  31.  
  32. require_once 'has_age.php';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement