Hello friends, I am looking for a script or code to put it on a index page of adult site that asks for visitors age. I dont want this in HTML so that user has to go thru this every time.. i want it to set a cookie if user has already entered his/her age... once he dont have to do it again.. Very good example of this is Pornotube.com can anyone help me with this please
<?php $verified = false; if ($_POST['verify']) { extract(array_map('intval', $_POST)); if (!checkdate($month, $day, $year)) { exit('Invalid birthday.'); } $now = mktime(0, 0, 0); $birthday = mktime(0, 0, 0, $month, $day, $year); $age = intval(($now - $birthday) / (3600 * 24 * 365)); if ($age >= 18) { setcookie('age_verified', 1, time()+3600*24*7, '/'); $verified = true; } else { echo 'Sorry, you are too young.'; } } ?> <?php if (isset($_COOKIE['age_verified']) OR $verified) { // Page content } else { ?> <form action="" method="post"> <select name="day"> <option>Day</option> <?php for ($day = 1; $day <= 31; $day++) { echo "\t". '<option value="'. $day .'">'. $day ."</option>\n"; } ?> </select> <select name="month"> <option>Month</option> <?php for ($month = 1; $month <= 12; $month++) { echo "\t". '<option value="'. $month .'">'. $month ."</option>\n"; } ?> </select> <select name="year"> <option>Year</option> <?php for ($year = date('Y')-80; $year <= date('Y'); $year++) { echo "\t". '<option value="'. $year .'">'. $year ."</option>\n"; } ?> </select> <input type="submit" name="verify" value="Submit" /> </form> <?php } ?> PHP:
thanks buddy. will this redirect too the url which was entered? for example if user entered www.mysite.com/someotherpage.htm will this direct to it?