<?php
// call database
include_once 'connect/cms-config.php' ;
include_once 'requires/function.php' ;
												
// unset user session
unset($_SESSION['system_id']) ;
unset($_SESSION['system_name']) ;
unset($_SESSION['system_branch']) ;
unset($_SESSION['system_permission']) ;

// unset user cookie
$expired_time = (time() - 3600) ;
setcookie("system_id", $_SESSION['system_id'], $expired_time, "/") ;
setcookie("system_name", $_SESSION['system_name'], $expired_time, "/") ;
setcookie("system_branch", $_SESSION['system_branch'], $expired_time, "/") ;
setcookie("system_permission", $_SESSION['system_permission'], $expired_time, "/") ;

// unset company session
unset($_SESSION['system_company_id']) ;
unset($_SESSION['system_customer_id']) ;
unset($_SESSION['url_get_branch_admin']) ;
unset($_SESSION['nomination_password']) ;

// redirect page
header("Location: ".PATH) ;
exit ;

?>