<?php
class class_GlobalEvents extends GlobalEventsBase
{
	function init() {
		$this->events = array(
	'pageEvents' => array(
		'AfterSuccessfulLogin' => true 
	),
	'onScreenEvents' => array(
		 
	),
	'dashboardEvents' => array(
		 
	),
	'buttons' => array(
		 
	),
	'maps' => array(
		 
	),
	'tablePermissions' => array(
		 
	),
	'recordEditable' => array(
		 
	) 
);
	}

		function AfterSuccessfulLogin( $username, $password, &$data, $pageObject ) {
		if (isset($data["active"]) && (int)$data["active"] !== 1) {
    session_destroy();
    header("Location: login.php");
    exit();
}

$_SESSION["admin_user_id"] = (int)$data["ID"];
$_SESSION["admin_username"] = $data["username"];
$_SESSION["admin_fullname"] = $data["fullname"];
$_SESSION["admin_email"] = $data["email"];
$_SESSION["admin_groupid"] = $data["groupid"];
		;
		
	}
	
	// custom buttons 
	
	// ajax code snippets
	
	
	// field events
	

	// code snippets
	
}
?>
