<?php
if (file_exists("embedded/functions/site_functions.php"))
	{
	include_once("embedded/functions/site_functions.php");
	}
else
	{
include_once("../../embedded/functions/site_functions.php");
	}
$language=$_SESSION['language'];
if ($language==1)
	{
	$head1="Πρόβλημα!";
	$temp1="φωτ1";
	$temp2="φωτ2";
	$head2="Οχι αρνητικά επίπεδα!";
	$head3="Όχι μεγαλύτερο από 1000!";
	$head4=" έγκυρο. Εισάγετε ";
	$head5="Όχι ίδια επίπεδα!";
	$head6="Επιτυχής!";
	$head7="Μόνο αριθμοί!";
	}
else
	{
	$head1="Problem!";
	$temp1="Inli1";
	$temp2="Inli2";
	$head2="Not negative leves!";
	$head3="Not higher than 1000!";
	$head4=" valid!Fill in ";
	$head5="Not same levels!";
	$head6="Done!";
	$head7="Only Numbers!";
	}
if (isset($_GET["a"]) && !empty($_GET["a"]))
		{
	
		$msg="";
		$class="";
		$current="";
		$dcurrent="";
		
		
			$a=$_GET["a"];
			if ($a=="1")
				{
				$current="$temp1";
				$dcurrent="$temp2";
				}
			else if ($a=="2")
				{
				$current="$temp2";
				$dcurrent="$temp1";
				}
			else
				{
				$msg="$head1";
				$class="invalid";
				}
		}
if (isset($_GET["q"]) && !empty($_GET["q"]))
{		

		$q=$_GET["q"];
		if (is_numeric($q))
				{
				
				if (preg_match("/^-[(0-9).(0-9)]*$/i", $q) || preg_match("/^[(0-9).(0-9)]*$/i", $q))
					{
					if ( $q <= 0.00 || $q=="-".$q)
						{
						$msg= "$head2";
						$class="invalid";
						}
					else if( $q >=1001.00)
						{
						$msg= "$head3";
						$class="invalid";
						}
					else 
						{
						$msg=$current."$head4".$dcurrent."!";
						$class="valid";
							
						if (isset($_GET["p"]) && !empty($_GET["p"]))
							{
							$p=$_GET["p"];
							if (is_numeric($p))
								{
								if (preg_match("/^-[(0-9).(0-9)]*$/i", $p) || preg_match("/^[(0-9).(0-9)]*$/i", $p))
									{
									if ( $p <= 0.00 || $p=="-".$p)
										{
										$msg= "$head2";
										$class="invalid";
										}
									else if( $p >=1001.00)
										{
										$msg= "$head3";
										$class="invalid";
										}
									else
										{
										if ($q==$p)
											{
											$msg="$head5";
											$class="invalid";
											}
										else
											{
											$msg="$head6";
											$class="valid";
											}
										}
									}
								}
							}
						}	
					}
				}
				
		else
			{
			$msg= "$head7";
			$class="invalid";
			}
echo "<span class='$class'>$msg</span>";	
}
?>