Пример #1
0
 public static function getLoginUserTypeAdmin()
 {
     $err = true;
     if (SessionHandlers::isSetSession(User::SESSION_USER)) {
         $err = false;
         $log_user = new User();
         $log_user = SessionHandlers::getObjSession(User::SESSION_USER);
         if ($log_user->getStatus() == $log_user::STATUS_ADMIN) {
             return $log_user;
         } else {
             $err = true;
         }
     }
     if ($err) {
         self::pageError(User::LOGIN_FAIL);
         die;
     }
 }
Пример #2
0
<?php

///test file next time I will move it to controls to do it
require_once '../helper/session/SessionHandlers.php';
require_once '../models/User.php';
SessionHandlers::destroyAllSession();
/*
    header("Location:".dirname(__FILE__));*/
unset($_COOKIE[User::SESSION_USER]);
setcookie(User::SESSION_USER, null, -1, '/');
header("Location:../");
exit;
Пример #3
0
 public static function Page($array)
 {
     $log_user = Tool::getLoginUser();
     if ($array[0] == CREATE) {
         header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . CREATE);
     } elseif ($array[0] == EDIT) {
         $food = new Food();
         $food->setId($_GET['id']);
         $food->readDatabase();
         SessionHandlers::saveSession($user, 'edit_food');
         header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . EDIT);
     } elseif ($array[0] == SHOWHIDE) {
         header("Location:../?menu=" . PAGE_FOOD . "&cache=" . $_GET['cache']);
     } elseif ($array[0] == REFRESH) {
         header("Location:../?menu=" . PAGE_FOOD);
     } elseif ($array[0] == FRAME) {
         $food = new Food();
         //print_r($food->readDatabaseAll ());
         SessionHandlers::saveSession($food->readDatabaseAll(), 'foodList');
         header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . FRAME);
     } else {
         echo "page not found";
     }
     exit;
 }
Пример #4
0
<?php

$foodList = SessionHandlers::getObjSession("foodList");
//SessionHandlers::destroySession('foodList');
?>
				
<table class="table table-th-block table-dark">
	<thead>
		<tr>
			<th style="width: 100px"><?php 
i18n::getLabel("food.id");
?>
</th>
			<th><?php 
i18n::getLabel("food.image");
?>
</th>
			<th><?php 
i18n::getLabel("food.name");
?>
</th>
			<th><?php 
i18n::getLabel("food.price");
?>
</th>
			<th><?php 
i18n::getLabel("food.type");
?>
</th>
			<th><?php 
i18n::getLabel("food.counttype");
Пример #5
0
 public function getSession()
 {
     SessionHandlers::getObjSession(self::SESSION_USER);
 }
Пример #6
0
 public function getSession()
 {
     return SessionHandlers::getObjSession(self::SESSIONNAME);
 }
Пример #7
0
<?php

$page = CREATE;
$user = new User();
$edit = false;
if ($_GET[VIEW] == EDIT) {
    $edit = true;
    $user = SessionHandlers::getObjSession('edit_user');
    //SessionHandlers::destroySession('edit_user');
    $page = EDIT;
}
?>
<div class="container-fluid">
	<h1 class="page-heading"><?php 
i18n::getLabel("message.user.manageuser.title");
?>
</h1>
	<div class="the-box rounded">
		<form id="UserForm" method="post" class="form-horizontal"
			action="controls/UserControl.php?<?php 
echo $page;
?>
"
			data-bv-message="This value is not valid"
			data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
			data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
			data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
			<input type="hidden" name="id" value="<?php 
echo $user->getId();
?>
"/>
Пример #8
0
 public static function Page($array)
 {
     $log_user = Tool::getLoginUser();
     if ($array[0] == CREATE) {
         header("Location:../?menu=" . PAGE_MANAGE_USER . "&" . VIEW . "=" . CREATE);
     } elseif ($array[0] == EDIT) {
         $user = new User();
         $user->setId($_GET['id']);
         $user->readDatabase();
         SessionHandlers::saveSession($user, 'edit_user');
         header("Location:../?menu=" . PAGE_MANAGE_USER . "&" . VIEW . "=" . EDIT);
     } elseif ($array[0] == SHOWHIDE) {
         header("Location:../?menu=" . PAGE_MANAGE_USER . "&cache=" . $_GET['cache']);
     } elseif ($array[0] == REFRESH) {
         header("Location:../?menu=" . PAGE_MANAGE_USER);
     } else {
         echo "page not found";
     }
     exit;
 }
Пример #9
0
		}
	}
}
</script>
<?php 
require_once 'conf/define.php';
require_once 'helper/auto_include.php';
$site = new Site();
if (!$site->isSetSession()) {
    $site->setlanguage("en");
    $site->setSession();
} else {
    $site = $site->getSession();
}
// check language to show
SessionHandlers::checkSession();
$_SESSION["locale"] = $site->getlanguage();
if ($_SESSION["locale"] == "kh") {
    echo "<style> * { font-family: 'Khmer OS System','Khmer OS','Khmer OS Muol','Khmer OS Battambang'; !important }</style>";
}
$user1 = new User();
if ($user1->isLogin()) {
    $log_user = Tool::getLoginUser();
    if (!$site->isExist($log_user)) {
        $site->setrefUser($log_user->getId());
        $site->insertDatabase($log_user);
    } else {
        $site->setrefUser($log_user->getId());
        $site->setSessionByUser();
    }
    // HTML HEAD