<?php
/*
 **************************************************************************************************
 *    Copyright (c) 2010-2012 Just Another Video script
 *
 * 	  This file is part of Just Another Video Script.
 *    Version 1.4.3
 *    info@justanothervideoscript.com
 **************************************************************************************************
 *    Come to website for support or buying additional plugins/modules.
 *    http://justanothervideoscript.com/
 **************************************************************************************************
 *    By using this software you agree that you have read and acknowledged our End-User License
 *    Agreement available at http://justanothervideoscript.com/license and can be bound by it.
 **********************************************************************************
 */
global $sitepath ;
if (file_exists('./loginfunctions.inc')) {
	require_once './loginfunctions.inc' ;
}
elseif (@file_exists('../includes/loginfunctions.inc')) {
	@ require_once '../includes/loginfunctions.inc' ;
}
elseif (file_exists('includes/loginfunctions.inc')) {
	require_once 'includes/loginfunctions.inc' ;
}
else {
	die("Include Error") ;
}
$date = gmdate("'Y-m-d'") ;
$db = db_connect() ;
$user = new User($db) ;
$loggedIn = false ;
$sitefolder = getSetting("sitefolder", $db) ;
$template = getSetting("sitetemplate", $db) ;
$path = "http://".$_SERVER['SERVER_NAME'] ;
$ssitepath = "http://".$_SERVER['SERVER_NAME'].$sitefolder ;
$rootpath = $_SERVER['DOCUMENT_ROOT'].$sitefolder ;
$templateimagepath = $ssitepath.'templates/'.$template.'/images/' ;

if (isset($_GET['logout'])) {
	if ($_GET['logout'] == 1) {
		$user->_logout() ;
	}
}	
	
if (isset($_SESSION['session_logged'])) {
	if ($_SESSION['session_logged']) {
		$loggedIn = true ;
	}
}
$skipRefSet = false ;
if (isset($_GET['action'])) {
	if ($_GET['action'] == 'login') {
		$skipRefSet = true ;
		$_SESSION['session_url'] = $referrer ;
	}
}
if (!$skipRefSet)
	$_SESSION['session_url'] = $_SERVER['REQUEST_URI'] ;

?>
