<?php $minAge = 18; // You might read this from a file/database. $minAge *= 3600*24*365.25; // $minAge in seconds $html = <<< OET You must be 18 or older to view this site. <br /> <form action="#" method="post"> Please input your date of birth: <input type="text" name="dob" value="" /> <br /> <input type="submit" name="submit" value="Verify Age" /> </form> OET; if(isset($_POST)){ $birth_date = strtotime($_POST); if($birth_date =='') $birth_date = strtotime("now"); $now = strtotime("now"); $age = $now - $birth_date; // age is in seconds if($age > $minAge) echo "Over minimum age."; // You could use header here. else echo "Under minimum age or invalid date."; // You could use header here. } else { echo $html; } ?>
omega42 wrote: » @Zener It's still very vague. . . .