<?php
if (empty($_SESSION))
	{
	session_start();
	}
if((isset($_COOKIE['email']) && !isset($_SESSION['email'])) && (isset($_COOKIE['password']) && !isset($_SESSION['password'])) && (isset($_COOKIE['device_id']) && !isset($_SESSION['device_id'])) && (isset($_COOKIE['userlevel']) && !isset($_SESSION['userlevel'])))
{

include_once("embedded/functions/site_functions.php");
db_open();
$email=addslashes($_COOKIE['email']);
$password=addslashes($_COOKIE['password']);
$device_id=addslashes($_COOKIE['device_id']);
$userlevel=addslashes($_COOKIE['userlevel']);
$language=addslashes($_COOKIE['language']);
$time=time();
$a=password(2,$userlevel,$email,$password,$device_id,$time);
if ($a==1)
	{
	$b=user_find($email);
	$_SESSION['email']=$b[2];
	$_SESSION['password']=$b[12];
	$_SESSION['device_id']=$b[1];
	$_SESSION['userlevel']=$b[3];
	$_SESSION['language']=$b[16];
	}
else 
	{
	setcookie('email','$email',time()-3600);
	setcookie('password','$password',time()-3600);
	setcookie('device_id','$device_id',time()-3600);
	setcookie('userlevel','$userlevel',time()-3600);
	setcookie('language','$language',time()-3600);
	}
db_close();
}


?>