<?php
session_start();
if (!isset($_SESSION['userlogged']) OR $_SESSION['userlogged'] <> "YES") {
	$pagelocation	= $_SERVER['PHP_SELF'];
	//$pagelocation	= str_replace($pagelocation, "search_profiles.php", "search.php");
	if (!empty($_GET)) {
		$pagelocation	.= "?";
		foreach ($_GET as $key=>$value)
			$pagelocation	.= $key."=".$value."&";
		$pagelocation	= substr($pagelocation, 0, strlen($pagelocation)-1);
	}
	$_SESSION['triedpage']	= $pagelocation;
	header("Location: login.php");
	exit;
} else {
	$_SESSION['triedpage']	= "";
	//require_once "trackstatus.inc.php";
}
/*if (!in_array(basename($_SERVER['PHP_SELF']), $arrUserAllowedPages)) {
	if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) === false) {
		header("Location: logout.php");
		exit;
	}
}*/
?>