<?php
include_once("_dirinfo.php");
$sessionHandling = true;

include_once(PATH_TO_ROOT."init.php");

if ($_GET['logOut']) {
	session_regenerate_id();
	session_destroy();	
}

if (!$UserSession->IsLoggedIn()) {	
	$capi = true;
	include_once(PATH_TO_ROOT."_forms/forms.login.php");

} else {
	$date = date("Y-m-d H:i:s");
	$sql = 	" SELECT proj_name,loginSID,naziv_proj, b.id as id_project FROM ".DB_WARPIT_WEBCATI_BASE."._www_ids as a 
				INNER JOIN ".DB_WARPIT_WEBCATI_BASE."._Projects as b ON a.id_project = b.id
				WHERE b.active = 1 AND b.start_date < '$date' AND b.end_date > '$date' AND a.id_user = ".$_SESSION['UserInfo']['id']." AND a.user_type=".$_SESSION['UserInfo']['user_type'];
		$res = $db->SQLexecute($sql);
	while ($zad = mysql_fetch_assoc($res)) {
		if (!$zad['naziv_proj']) $zad['naziv_proj'] = $zad['proj_name'];
		$projects[$zad['id_project']] = $zad['naziv_proj'];
	}
	
	include_once(PATH_TO_ROOT."capi_html/_forms/forms.capi.main.php");
	
}

?>
