Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // check_age.php
- <?php
- session_start();
- if (isset($_POST['submit'], $_POST['adult']) && $_POST['adult'] == 1) {
- $_SESSION['adult'] = 'true';
- header ('location: index.php');
- }
- ?>
- <html>
- <head></head>
- <form action="" method="POST">
- <input type="checkbox" name="adult" value="1">
- I am over 21 years old
- <input type="submit" name="submit">
- </form>
- </html>
- // has_age.php
- <?php
- session_start();
- if (!isset($_SESSION['adult'])) {
- header('location: check_age.php');
- }
- ?>
- // index.php
- // first line
- require_once 'has_age.php';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement