<?php

	/* Grab the URL variable */
	$Seed = $_GET["Seed"];
	$doy = $_GET["doy"];
	/* Connect to database and grab the keys */
$servername = "localhost";
$username = "u9cwxhx7pzvxt";
$password = "Maggie@2014SG$2014%%";
$dbname = "phibase0_FSP";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
	
	$query = "SELECT `real1` FROM `real1`";
	$result = $conn->query($query);
	$num=$result->num_rows;	


	/* Set up a loop to check if requested key is found in database */
	$i=0;
	$validationkey = 0;

	$validation = "";

if ($result=mysqli_query($conn,$query))
{
	while ($obj=mysqli_fetch_object($result))
	{
		if ($Seed == $obj->real1)
		{
			$validation = "Success";
		}	
	}
	mysqli_free_result($result);
}	


	/* If a match was found in database, echo "VALID". Else echo "ERROR" */
	if($validation != "") {
		echo ($Seed  % 961) + 96  ;
	} else {
		echo 111111;
	}


?>