"Age Gate", "content_title" => "Age Gate", "page_type_id" => "AGEFILTER", ); $ref = urldecode($_REQUEST['ref']); $user_age = 0; $show_form = true; // see if they already have the cookie. if( isset($_COOKIE["da_agegate"]) ) { $user_age = getAge( $_COOKIE["da_agegate"] ); $show_form = false; } elseif(isset($_POST['year']) && $_POST['year'] != "") { $dob_month = $_POST['month']; $dob_day = $_POST['day']; $dob_year = $_POST['year']; $birthdate = $dob_month . "/" . $dob_day . "/" . $dob_year; $user_age = getAge( $birthdate ); setcookie( "da_agegate", $birthdate, strtotime("+1 year"), "/", ".bioware.com" ); $show_form = false; } if( $user_age >= MINIMUM_ESRB_AGE ) { $redirect_url = "/"; // default if($ref != "" && $ref != $_SERVER['PHP_SELF']) { $redirect_url = $ref; } header("Location: $redirect_url"); exit; } ?>