<?php
require_once ("../config.inc.php");
require_once ("mysql_mobile.inc.php");
require_once ("../classes/misc.class.php");
$arrChatPages	= array("chatbox.php", "chatboxsession.php", "getchatmessage.php",
						"getchatrequests.php", "getchatrequests_one.php",
						"getchatrequests_two.php");
if (isset($_SESSION['userlogged']) AND $_SESSION['userlogged'] == "YES") {
	$objULM	= new misc($objDB);
	if (!$objULM->check_user_ip($_SESSION['user_id'], $_SESSION['user_ip'])) {
		$objULM->logout($_SESSION['user_id']);
		$_SESSION['userlogged'] = "";
		unset($_SESSION['userlogged']);
		$_SESSION['user_login'] = "";
		unset($_SESSION['user_login']);
		$_SESSION['user_id'] = "";
		unset($_SESSION['user_id']);
		$_SESSION['user_gender'] = "";
		unset($_SESSION['user_gender']);
		$_SESSION['user_name'] = "";
		unset($_SESSION['user_name']);
		$_SESSION['user_ip'] = "";
		unset($_SESSION['user_ip']);
		if (!in_array(basename($_SERVER['PHP_SELF']), $arrChatPages)) { 
			header("Location: index.php?msg=s");
			exit();
		}
	}
	$objULM->loggedin_track($_SESSION['user_id']);
	unset($objULM);
}
?>