<?php 
require('includes/settings.php');
require('includes/mysql_connect.php');
require('includes/funcs.php');
if (isset($_POST['submit']))
{
	$eligible = sanitize($_POST['submit']);
	if (substr($eligible,0,3) == 'Yes')
	{
		session_start();
		$_SESSION['eligible'] = 'Y';
		$randomString = substr( md5(uniqid(rand(), true)), 3, 10);
		$_SESSION['randomString'] = $randomString;

		header('Location: contest_page2.php');
	}
	else
	{
		$strValidationB = '<h3 class="textCenter">Sorry. You must be over 18 to enter this contest</h3>';
	}
}

include('includes/header.php'); 
?>

<body class="internal">
	<script src="../assets/scripts/jquery.screwdefaultbuttonsV2.js"></script>
	
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="ageForm" class="form" enctype="multipart/form-data" >
		<header>
			<a href='index.php' class='button home'>HOME</a>
		</header>
		<main class="container">
			<?php if ($strValidationB) echo '<div class="strValidationB">'.$strValidationB.'</div>'; ?>
			<h3 class="defaultText textCenter">YOU MUST BE OVER 18 YEARS OLD TO ENTER THIS CONTEST</h3><br><br>
			<div class="centerContent span12" align="center">
				
				<div class="vMiddle">
					<input type="submit" value="Yes, I am over 18 years old." name="submit" class="button buttonLRG validAGE">	
				</div>
				<br>
				<div class="vMiddle">
					<input type="submit" value="No, I am not over 18 years old." name="submit" class="button buttonLRG validAGE">
				</div>
				
				
			</div>
		</main>
	
		<footer class="clearfix span11 centerContent">
			<div class="span10 column">
				<a href="#rules" class="fancybox" >CONTEST RULES AND REGULATIONS</a>
				<div id="rules">
					<?php include('rules.php') ?>
				</div>
			</div>
		</footer>
	</form>

	<script type="text/javascript">
		
	 	$('input:radio').screwDefaultButtons(
	 	{
	        image: 'url("assets/images/radioSmall-alt.png")',
	        width: 43,
	        height: 43
	    });
	</script>
</body>
</html>