public function login($do = 0) { if (!$do) { $smarty = get_smarty(); $admin_login_url = url('admin', 'adminorder::login', 1); $smarty->assign('admin_login_url', $admin_login_url); $smarty->display('admin/order/login.html'); } else { $username = htmlspecialchars($_POST['username']); $password = htmlspecialchars($_POST['password']); $res = AdminUser::userLogin($username, $password); if ($res) { LuS::set('admin_order_uid', $res['id']); LuS::set('admin_order_username', $res['username']); $url = url('admin', 'adminorder::index'); header('Location:' . $url); throw new Exception('exit'); } else { $admin_login_url = url('admin', 'adminorder::login'); header('Location:' . $admin_login_url); throw new Exception('exit'); } } }