Location: PHPKode > projects > TLD Manager > tldmgr/include/verify.php
<?
$ID = $_COOKIE["ID"];
if (! $ID) {
	header("Location: login.php?fail=expired");

} else {
	include("include/config.php"); 
	mysql_connect($db_host,$db_user,$db_pass);
	@mysql_select_db($db_name) or die( "Unable to select database \"$db_name @ $db_host\"");

	$result = mysql_query("SELECT * FROM session WHERE ID='$ID'");
	if (mysql_numrows($result) == 0) {
		mysql_query("DELETE FROM session WHERE ID='$ID'");
		setcookie("ID", "");	
		mysql_close();
		header("Location: login.php?fail=expired");

	} else {
		$user_IP = mysql_result($result,0,"IP");
		$expire = mysql_result($result,0,"expire");
		if (($expire < date("U")) || ($user_IP != GetHostByName($REMOTE_ADDR))) {
			mysql_query("DELETE FROM session WHERE ID='$ID'");
			setcookie("ID", "");	
			mysql_close();
			header("Location: login.php?fail=expired"); 

	} else {
			$user_nick = mysql_result($result,0,"user");
			$expire = date("U") + $login_expires;
			$result = mysql_query("UPDATE session SET expire=$expire WHERE ID='$ID'");
			setcookie("ID", $ID, $expire);

			$result = mysql_query("SELECT * FROM user WHERE nick='$user_nick'");
			$user_email = mysql_result($result,0,"email");
			$user_level = mysql_result($result,0,"level");
			
			mysql_close();
		}
	}
}
?>
Return current item: TLD Manager