$controller->view->menu = 'login'; $controller->set('spTitle', 'Seo Panel: Login section'); $controller->set('spDescription', 'Login to Seo Panel and utilise seo tools and plugins to increase the perfomance of your site.'); $controller->set('spKeywords', 'Seo Panel Login section'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_POST['sec']) { case "login": $controller->login(); break; case "requestpass": $controller->set('spTitle', 'Seo panel forgot password'); $controller->requestPassword($_POST['email']); break; default: $controller->index(); break; } } else { switch ($_GET['sec']) { case "logout": $controller->logout(); break; case "forgot": $controller->set('spTitle', 'Seo Panel forgot password'); $controller->forgotPasswordForm(); break; default: $controller->index($_GET); break; } }
$UserController->deleteUser(); break; case "getUser": $UserController->getUser(); break; case "checkLoggedIn": $UserController->checkLoggedIn(); break; case "isAdmin": $UserController->isAdmin(); break; case "login": $UserController->login(); break; case "logout": $UserController->logout(); break; // Project Methods // Project Methods case "createProject": $ProjectController->createProject(); break; case "deleteProject": $ProjectController->deleteProject(); break; case "getProject": $ProjectController->getProject(); break; case "getProjects": $ProjectController->getProjects(); break;
$routes->get('/hero/:id/edit', function ($id) { HeroController::edit($id); }); $routes->post('/hero/:id/edit', function ($id) { HeroController::update($id); }); $routes->get('/login', function () { // Kirjautumislomakkeen esittäminen UserController::login(); }); $routes->post('/login', function () { // Kirjautumisen käsittely UserController::handle_login(); }); $routes->post('/logout', function () { UserController::logout(); }); $routes->post('/hero/:id/destroy', function ($id) { HeroController::destroy($id); }); $routes->get('/drafts', function () { DraftController::index(); }); $routes->get('/drafts/new', function () { DraftController::create(); }); $routes->get('/drafts/:id', function ($id) { DraftController::show($id); }); $routes->post('/drafts', function () { DraftController::store();
$url = filter_var($_GET['url'], FILTER_SANITIZE_STRING); } /* * Check URL to send request to the right controller */ switch ($url) { case "login": include_once "controllers/UserController.php"; $user = new UserController(); $user->login(); $user->showLogin(); break; case "logout": include_once "controllers/UserController.php"; $user = new UserController(); $user->logout(); break; case "register": include_once "controllers/UserController.php"; $user = new UserController(); $user->register(); break; case "user": include_once "controllers/UserController.php"; $user = new UserController(); if ($_GET["action"] == "update") { $user->update(); } if ($_GET["action"] == "delete") { $user->delete(); }
} break; //Send //Send case 'Send': //prüft ob die Customer Daten erfolgreich gespeichert wurden if ($cust_controller->registerCustomer()) { header("Location:./view/LoginView.php"); } else { header("Location:./view/RegisterView.php?err=13"); } break; //logout //logout case 'logout': $user_controller->logout(); header("Location:view/LoginView.php"); break; // admin operations // admin operations case 'show-Userlist': header("Location:view/UserListView.php"); break; case 'show-Customers': header("Location:view/CustomerListView.php"); break; case 'show-Orders': header("Location:view/OrderView.php"); break; case 'Back': header("Location:view/AdminView.php");
$app->render($data['layout'] . '.php', $data); }); $app->get('/user/login', function () use($app) { $userController = new UserController(); $data = $userController->login(); $app->render($data['layout'] . '.php', $data); }); // POST route $app->post('/user/login', function () use($app) { $userController = new UserController(); $data = $userController->login(); $app->render($data['layout'] . '.php', $data); }); $app->get('/user/logout', function () use($app) { $userController = new UserController(); $data = $userController->logout(); }); $app->get('/user/profile', function () use($app) { $userController = new UserController(); $data = $userController->profile(); $app->render($data['layout'] . '.php', $data); }); // POST route $app->post('/user/profile', function () use($app) { $userController = new UserController(); $data = $userController->profile(); $app->render($data['layout'] . '.php', $data); }); // POST route $app->post('/user/changepassword', function () use($app) { $userController = new UserController();
static function profile($args = null) { if (isset($_SESSION['user_login']) && time() - $_SESSION['user_login'] > 60) { UserController::logout(); } if (isset($_SESSION['user_id']) && $_SESSION['user_id']) { return View::Show('msg', ["name" => $_SESSION['user_name']]); } else { UserController::logout(); } }
<?php if (UserController::logout() === true) { echo "ok"; exit; } else { echo "badLogout"; exit; } echo "error"; exit;