<?php 
include('../includes/settings.php');
include('../includes/mysql_connect.php');
include('../includes/funcs.php');
if (isset($_POST['submit']))
{
	$eligible = sanitize($_POST['eligible']);
	if ($eligible == '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>';
	}
}
?>
<?php include('../includes/pp-header.php'); ?>
<body class="pp-top">
	<script src="../assets/scripts/jquery.screwdefaultbuttonsV2.js"></script>
	<script type="text/javascript" src="../assets/scripts/check.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="pinkText">'.$strValidationB.'</div>'; ?>
			<h3 class="yellowText textCenter">YOU MUST BE OVER 18 YEARS OLD TO ENTER THIS CONTEST</h3>
			<div class="centerContent span6">
				
				<div class="vMiddle">
					<input type="radio" value="Yes" id="Yes" name="eligible" >
					
					<span class="checklabel">Yes, I am over 18 years old.</span>
				</div>
				<div class="vMiddle">
					<input type="radio" value="No" id="No" name="eligible" >
					
					<span class="checklabel">No, I am not over 18 years old.</span>
				</div>
				
				
			</div>
		</main>
	
		<footer class="clearfix span11 centerContent">
			<div class="span5 column">
				<a href="#rules" class="fancybox" >CONTEST RULES AND REGULATIONS</a>
				<div id="rules">
					<?php include('rules.php') ?>
				</div>
			</div>
			<div class="span6 textRight column">
				<input type="submit" value="NEXT" name="submit" class="button">	
			</div>
		</footer>
	</form>

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

</body>
</html>

