<?php
if (file_exists("functions/site_functions.php"))
		{
		include_once("functions/site_functions.php");
		}
	else
		{
	include_once("../../functions/site_functions.php");
		}
if ($_GET["q"]==1)
	{
	
		echo '<input type="text" id="7_id" name="email" onchange="validator(this.value,7);" /><a id="7_msg" class="o_msg"></a>';
		
	}
else if ($_GET["q"]==2)
	{
	if ((isset($_GET['d']) && !empty($_GET['d']) && is_numeric($_GET['d'])) && (isset($_GET['email']) && !empty($_GET['email']) && preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $_GET['email'])))
		{
		$device_id=$_GET['d'];
		$email=$_GET['email'];
		db_open();
		$sql="SELECT * FROM users WHERE device_id='$device_id'";
		@ $resul=mysql_query($sql);
		if (mysql_numrows($resul)!=0)
			{
			$sqll="UPDATE users SET email='$email' WHERE device_id='$device_id'";
			@ $result=mysql_query($sqll);
			if ($result==1)
				{
				echo $email;
				}
			}
		db_close();
		}
	}
else
	{
	die();
	}
 
?>