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; }
public function setSession() { SessionHandlers::saveSession($this, self::SESSIONNAME); }
public function isExist() { $username = $this->username; $password = $this->password; // return to result to check name have in record or not $result = $this->readDatabase('where username = ?', array($username)); if (!empty($result)) { if ($this->username == $username && password_verify($password, $this->dbpassword)) { // update time in cookies // setcookie ( self::SESSION_USER, serialize ( $this ), time () + (900), "/" ); // 900s = 15m SessionHandlers::saveSession($this, self::SESSION_USER); // echo "add cookies"; return TRUE; // true } //echo "password incorrect"; $_POST[self::LOGIN_EVENT] = self::LOGIN_FAIL; return FALSE; // false } else { if (isset($_POST[self::LOGIN_EVENT])) { $_POST[self::LOGIN_EVENT] = $_POST[self::LOGIN_EVENT]; } //Tool::pageError(User::LOGIN_FAIL); //echo "\$result empty in isExist()"; return FALSE; // false } }
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; }