Example #1
0
/** Login Class**/
require_once '../PLC/plc.class.php';

if($_GET['p'] == 6 || $_GET['p'] == 5 || $_GET['logout']==1){

	/** Login **/

	$user = new flexibleAccess();
	if ( $_GET['logout'] == 1 ){
		$user->logout();
	}
	if ( !$user->autologin()){
		header("Location: ../PLC/index.php");
		exit; //To ensure security
	}else{
		$cookie 				= $user->read_cookie();
		$_SESSION['u_id'] 		= $user->userData[$user->tbFields['userID']];
		$_SESSION['u_name'] 	= $user->userData[$user->tbFields['login']];
		$_SESSION['u_email'] 	= $user->userData[$user->tbFields['email']];
		$_SESSION['role'] 		= $user->userData['role'];
		$_SESSION['property'] 	= $user->userData['property_id'];
		$_SESSION['u_time'] 	= date("Y-m-d H:i:s", time());
		$_SESSION['u_lang'] 	= $user->userData['lang_id'];
		$_SESSION["valid_user"] = TRUE;
	}
}

$_SESSION['role'] = ( $_SESSION['role']!='1' ) ? $_SESSION['role'] : 6;

// ** set configuration
	include('../config/config.general.php');