<?php
if (isset($_GET["q"]) && !empty($_GET["q"]))
{

if (file_exists("embedded/functions/site_functions.php"))
	{
	include_once("embedded/functions/site_functions.php");
	}
else
	{
include_once("../../embedded/functions/site_functions.php");
	}
db_open();	
if ((isset($_SESSION['language']) && !empty($_SESSION['language'])) || (isset($_SESSION['lang']) && !empty($_SESSION['lang'])))
	{
	if (!empty($_SESSION['language']))
	{
	$language=$_SESSION['language'];
	}
	else
	{
	$language=$_SESSION['lang'];
	}
	if ($language==1)
		{
		$head1="Μη έγκυρο email!";
		$head2="Email χρήστη!";
		$head3="Λάθος διεύθυνση!";
		$head4="Έγκυρο email!";
		}
	else
		{
		$head1="Invalid address!";
		$head2="Address exist!";
		$head3="Wrong Address!";
		$head4="Valid address!";
		}
	}
else
	{
	$head1="Invalid address!";
	$head2="Address exist!";
	$head3="Wrong Address!";
	$head4="Valid address!";
	}
$email=	$_GET["q"];
	if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))
	{
	echo '<span class="invalid">'.$head1.'</span>';
	}
	else
	{
	if (isset($_GET["qq"]) && !empty($_GET["qq"]))
		{
		$qq=$_GET["qq"];
		if($qq==1)
		{
			
			$b=user_find($email);
			
			if(!empty($b))
				{
				echo '<span class="valid">'.$head2.'</span>';
				}
			else
				{
				echo'<span class="invalid">'.$head3.'</span>';
				}
			}
		else if ($qq==2)
			{
			
			$b=user_find($email);
			
			if(!empty($b))
				{
				echo '<span class="invalid">'.$head2.'</span>';
				}
			else
				{
				echo '<span class="valid">'.$head4.'</span>';
				}
			}
		else
			{
			echo '<span class="valid">'.$head4.'!</span>';
			}
		}
	}
db_close();
}

?>