root . 'lib/utils.inc.php'; $auth_url = $_SERVER['PHP_SELF'] . '?op=login'; $login = $_SERVER['PHP_SELF']; $login_form = << Login

Login

LF; $login_error = << Error

ERROR

__ERROR__

Login

LE; $util = Utils::getInstance(); if (isset($_GET['op'])) $action = $_GET['op']; else $action = 'default'; if ($action == 'logout') { // logout $util->logout(); echo $login_form; } else if ($action == 'login') { // login $user = $_POST['user']; $password = $_POST['password']; if ($util->login($user, $password)) { header('Location: index.php'); } else { $error = $util->getLoginStatus(); $error = str_replace('__ERROR__', $error, $login_error); echo $error; } } else { echo $login_form; } ?>