public static function isLoginSuccessful() { $data = filter_input_array(INPUT_POST, CustomerController::getLoginRules()); if (CustomerController::checkValues($data)) { $username = $data["uname"]; $result = UsersDB::getPassword(["uporabnisko_ime" => $username]); if ($result != null && password_verify($data["password"], $result["geslo"]) && UsersDB::isCustomer(["uporabnik_id" => $result["id"]]) && UsersDB::isactivate(["id" => $result["id"]])) { session_start(); $_SESSION["active"] = TRUE; $_SESSION["role"] = "customer"; $_SESSION["id"] = $result["id"]; return true; } } return false; }
public static function check() { $data = filter_input_array(INPUT_POST, self::getLoginRules()); if (self::checkValues($data)) { $username = $data["uname"]; $result = UsersDB::getPassword(["uporabnisko_ime" => $username]); if ($result != null && password_verify($data["password"], $result["geslo"]) && UsersDB::isCustomer(["uporabnik_id" => $result["id"]]) && UsersDB::isActivate(["id" => $result["id"]])) { $_SESSION["active"] = TRUE; $_SESSION["role"] = "customer"; $_SESSION["id"] = $result["id"]; ViewHelper::redirect(BASE_URL . "customer"); } else { $data["password"] = ""; self::login($data); } } else { $data["password"] = ""; self::login($data); } }
public static function check() { $data = filter_input_array(INPUT_POST, self::getLoginRules()); if (self::checkValues($data)) { $username = $data["uname"]; $result = UsersDB::getPassword(["uporabnisko_ime" => $username]); if ($result != null && password_verify($data["password"], $result["geslo"]) && UsersDB::isSalesman(["uporabnik_id" => $result["id"]]) == 1) { $_SESSION["active"] = TRUE; $_SESSION["role"] = "salesman"; $_SESSION["id"] = $result["id"]; $user = UsersDB::getSalesman(["id" => $_SESSION["id"]]); self::addActionToDiary($_SESSION["id"], "Prodajalec z id-jem " . $_SESSION["id"] . "se je prijavil v sistem"); ViewHelper::redirect(BASE_URL); } else { unset($data["password"]); self::login($data); } } else { unset($data["password"]); self::login($data); } }
public static function check() { $data = filter_input_array(INPUT_POST, self::getLoginRules()); if (self::checkValues($data)) { $username = $data["uname"]; $result = UsersDB::getPassword(["uporabnisko_ime" => $username]); if ($result != null && password_verify($data["password"], $result["geslo"]) && UsersDB::isAdmin(["uporabnik_id" => $result["id"]]) == 1) { $_SESSION["active"] = TRUE; $_SESSION["role"] = "admin"; $_SESSION["id"] = $result["id"]; self::addActionToDiary($_SESSION["id"], "Administrator z id-jem " . $_SESSION["id"] . " se je prijavil v sistem"); ViewHelper::redirect(BASE_URL); } else { $data["password"] = ""; self::login($data); } } else { //sicer prikažemo obrazec, ki ni uspel $data["password"] = ""; self::login($data); } }