View difference between Paste ID: mWZVbtun and MnEP52wk
SHOW: | | - or go back to the newest paste.
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
<form action="" method="POST">
12
<input type="checkbox" name="adult" value="1">
13
I am over 21 years old
14-
<input type="submit" name="submit">
14+
<input type="submit" name="submit" value="Confirm">
15
</form>
16
</html>
17
18
// has_age.php
19
<?php
20
session_start();
21
if (!isset($_SESSION['adult'])) {
22
header('location: check_age.php');
23
}
24
?>
25
26
// index.php
27
28
// first line 
29
30
require_once 'has_age.php';