public function init() { UserController::$dataTableUrl = adminAppUrl('system/user/dataTable'); UserController::$modUrl = adminAppUrl('system/user/mod?id='); UserController::$addUrl = adminAppUrl('system/user/add'); UserController::$modPasswordUrl = adminAppUrl('system/user/modPassword?id='); UserController::$delUrl = adminAppUrl('system/user/del?id='); UserController::$login = adminAppUrl('system/user/login?uname='); UserController::$sGetUserRoleids = adminAppUrl('system/user/sGetUserRoleids'); }
private static function runApi() { try { //Reviews if (preg_match("/api\\/reviews\\/create/", self::$uri, $matches)) { $controller = new RestaurantController(); //TODO validate user //throw new FoodoException("Bad user key"); if (count($_POST) > 0 and isset($_POST['user_id']) and isset($_POST['restaurant_id']) and isset($_POST['review'])) { $controller->createReview($_POST['restaurant_id'], $_POST['user_id'], $_POST['review']); } else { throw new FoodoException("Data missing for review"); } } elseif (preg_match("/api\\/restaurant\\/id\\/([0-9]+)\\/reviews/", self::$uri, $matches)) { $controller = new RestaurantController(); $controller->showReviewsFromId($matches[1]); } elseif (preg_match("/api\\/restaurant\\/id\\/([0-9]+)\\/rate\\/([0-9].[0-9]|[0-9])\\/user_id\\/([0-9]+)/", self::$uri, $matches)) { $controller = new RestaurantController(); $controller->rateRestaurant($matches[1], number_format($matches[2], 1), $matches[3]); } elseif (preg_match("/api\\/restaurant\\/id\\/([0-9]+)/", self::$uri, $matches)) { $controller = new RestaurantController(); $controller->showFromId($matches[1]); } elseif (preg_match("/api\\/restaurant/", self::$uri, $matches)) { $controller = new RestaurantController(); $controller->showAll(); } elseif (preg_match("/api\\/user\\/login\\/(.*)\\/(.*)/", self::$uri, $matches)) { $controller = new UserController(); $controller->login($matches[1], $matches[2]); } elseif (preg_match("/api\\/user\\/signup\\/(.*)\\/(.*)\\/(.*)\\/(.*)/", self::$uri, $matches)) { $controller = new UserController(); $controller->signup($matches[1], $matches[2], $matches[3], $matches[4]); } elseif (preg_match("/api\\/types/", self::$uri, $matches)) { $controller = new RestaurantController(); $controller->showAllTypes(); } else { echo json_encode(array("responseData" => '', "responseDetails" => "Bad request", "responseCode" => 404)); } } catch (FoodoException $e) { echo json_encode(array("responseData" => "FoodoException", "responseDetails" => $e->getMessage(), "responseCode" => 500)); } catch (Exception $e) { echo json_encode(array("responseData" => 'Exception', "responseDetails" => $e->getMessage(), "responseCode" => 500)); } }
<?php $username = $_POST['username']; $password = $_POST['password']; $id = $_POST['id']; if (UserController::authenticateLogin($username, $password, $id) === true) { UserController::login($username, $id); echo "ok"; exit; } else { echo "badLogin"; exit; } echo "error"; exit;
<?php header("Content-Type:application/json"); include '../controller/UserController.php'; $user = new UserController(); $user->login($_POST);
******************************/ switch ($op) { //verweist einen leeren op an die Loginseite (erste Ladung des Shops) case "": header("Location:./view/LoginView.php"); break; //basic login logout operations //basic login logout operations case 'Login': //session Variablen $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; $username = $_SESSION['username']; $password = $_SESSION['password']; //prüft ob der user existiert und ob das password stimmt if ($user_controller->login($username, $password)) { if ($user_controller->checkAdmin($username)) { // admin view header("Location:view/AdminView.php"); } else { //normaler User link zum Shop header("Location:view/ShopView.php"); } } else { /*wenn der Username oder das Passwort nicht stimmt wird der User züruck an die Loginseite verwiesen mit einer Error Meldung*/ header("Location:./view/LoginView.php?err=37"); } break; case 'BacktoLogin': header("Location:./view/LoginView.php");
<?php require_once 'user_controller.inc.php'; require_once 'user_model.inc.php'; require_once 'adapter.php'; @($op = $_REQUEST['op']); $user_controller = new UserController(); $bill = new EditBillAdapter(new UserController()); //$facebook = new FacebookAdapter(new Facebook()); switch ($op) { case 'login': $username = $_POST['user']; $password = $_POST['pass']; if ($user_controller->login($username, $password) == 'true') { header("Location:dashboard1.php"); } else { header("Location:login.php?err=1"); } break; case 'register': $usertype = $_POST['inputUsertype']; $name = $_POST['inputText']; $password = $_POST['inputPassword']; $email = $_POST['inputEmail']; if ($user_controller->create($usertype, $name, $password, $email) == false) { header("Location:register.php?err=1"); } else { header("Location:dashboard.php"); } break; case 'creategroup':
<?php require '../app/Controllers/UserController.php'; if (isset($_GET['url']) && $_GET['url'] == 'auth/register') { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $a = new UserController(); $a->register($_POST); } else { header('Location: ../views/register.php'); } } else { if (isset($_GET['url']) && $_GET['url'] == 'auth/login') { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $a = new UserController(); $a->login($_POST); } else { //ob_start(); header('Location: ../views/login.php'); } } }
$UserController->createUser(); break; case "deleteUser": $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;
$app->render($data['layout'] . '.php', $data); }); $app->post('/comics/delete', function () use($app) { $comicController = new ComicController(); $data = $comicController->delete(); $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();
<?php require "vendor/autoload.php"; error_reporting(E_ALL); ini_set("display_errors", "On"); //simpler routing mechanism for serving pages $link = $_SERVER['REQUEST_URI']; $userModel = new UserModel(); $userController = new UserController($userModel); $catalogModel = new CatalogModel(); $catalogModel->setCatalog(); $catalogController = new CatalogController($catalogModel); if ($link === '/') { $userController->index(); } elseif ($link === '/login') { $username = $_POST['username']; $password = $_POST['password']; $form_token = $_POST['form_token']; $userController->login($username, $password, $form_token); } elseif ($link === '/logout') { $userController->logout(); } elseif ($link === '/catalog') { $catalogController->index(); } elseif ($link === '/order') { $json = $_POST['order']; $catalogController->order($json); }
<?php /** * Created by PhpStorm. * User: Haziq * Date: 12/9/2015 * Time: 1:23 AM */ require_once $_SERVER['DOCUMENT_ROOT'] . '/matrimonialweb/Controller/UserController.php'; $data = array(); if (isset($_POST['user']) && isset($_POST['password'])) { $username = $_POST['user']; $password = $_POST['password']; if ($username != "" && $password != "") { $Object = new UserController(); $data = $Object->login($username, $password); echo json_encode($data); } else { array_push($data, ["Status" => "error", "Message" => "All fields must be provided"]); echo json_encode($data); } } else { array_push($data, ["Status" => "error", "Message" => "Some error occurred"]); echo json_encode($data); }
} } else { $app = new AppController(); $app->Erro('متاسفانه در فرآیند رزرو خطایی رخ داد'); } break; } break; case 'user': $usr = new UserController(); switch ($action) { case 'login': if (isset($_SESSION['user']['id'])) { header('location:index.php?controller=hotel&action=search'); } else { $usr->login(); } break; case 'login_check': $usr->login_check($_POST['username'], $_POST['password']); break; case 'safar_login_check': $usr->safar_login_check($_POST['username'], $_POST['password'], $_GET['ret']); break; case 'dashboard': $usr->dashboard(); break; case 'new': if (isset($_SESSION['user']['isadmin']) && $_SESSION['user']['isadmin']) { if (isset($_POST['username'])) { if ($_POST['password'] == $_POST['password_repeat']) {
}); $routes->post('/register', function () { $params = $_POST; $content = UserController::register($params); BaseController::set_flash($content); Redirect::to("/"); }); $routes->get('/logout', function () { UserController::logout(); }); $routes->get('/login', function () { View::make('register.html'); }); $routes->post('/login', function () { $params = $_POST; $content = UserController::login($params); BaseController::set_flash($content); Redirect::to("/"); }); $routes->get('/image-:id', function ($id) { $content = ImageController::get($id); View::make("image.html", $content); }); $routes->get('/uploadImage', function () { View::make('uploadImage.html'); }); $routes->post('/comment', function () { $params = $_POST; $content = CommentController::add($params); BaseController::set_flash($content); var_dump($params);
$userController->authentify(); break; case 'logout': $userController->logout(); break; case 'registerView': $userController->registerView(); break; case 'register': $userController->register($_POST); break; case 'loginView': $userController->loginView(); break; case 'login': $userController->login($_POST); break; case 'insertProject': $projectController->insertProject($_POST); break; case 'updateProject': $projectController->update($_POST); break; case 'removeProject': $projectController->removeProject($_GET["IDPROJECT"], $_GET["IDUSER"]); break; case 'newProject': $projectController->newProject(); break; case 'updateViewProject': $projectController->updateProject($_GET["IDPROJECT"]);
<?php include_once '../controller/UserController.php'; $reg = new UserController(); $error = "OK"; $user_logged = false; if (isset($_POST["login"]) && isset($_POST["pass"])) { $error = $reg->login($_POST["login"], $_POST["pass"]); if ($error == "OK") { $user_logged = true; } } echo '<div id="login"> <h1>Login</h1>'; if (!$user_logged && !isset($_SESSION["user"])) { echo '<form name="login" method="post" action="layout.php?selected=login"> <input type="text" placeholder="Login" name="login"/> <input type="password" placeholder="Password" name="pass"/>'; if ($error != "OK") { echo '<div class="alert alert-danger" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span>' . $error . '</div>'; } echo ' <input type="submit" value="Register"/> </form>'; } else { echo ' <div class="alert alert-success" role="alert"> <b>Login success !</b></br> Welcome ' . $_SESSION["user"] . ' </br> <a href="layout.php"><button type="button" class="btn btn-success">Start !</button></a></div>'; } echo '</div>';
/* * Sanitize vars */ if (!isset($_GET["url"])) { $url = "login"; } else { $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();
<?php require_once '../controllo/UserController.php'; @($op = $_REQUEST['op']); $userController = new UserController(); switch ($op) { case 'login': $username = $_POST['user']; $password = $_POST['pass']; if ($userController->login($username, $password) == 'utente') { header("Location:pre_utente.php"); } elseif ($userController->login($username, $password) == 'admin') { header("Location:admin.php"); } else { header("Location:login.php?err=1"); } break; case 'logout': $userController->logout(); header("Location:login.php"); break; default: header("Location:login.php"); break; }
}); $routes->get('/hero/new', function () { HeroController::create(); }); $routes->get('/hero/:id', function ($id) { HeroController::show($id); }); $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 () {
public function search_by_username($username) { return $this->_user_model->fetch_user($username); } // Log a user out of the site securely public function logout() { $_SESSION = array(); // Unset session variables setcookie(session_name(), '', 1); // Remove session cookie session_destroy(); // Destroy session header('Location: index.php'); } } $user_controller = new UserController($db); // Initialize User Controller // HTTP Requests if (isset($_POST['login'])) { // Login Request $user_controller->login($_POST['username'], $_POST['password']); } if (isset($_POST['register'])) { // Registration Request $user_controller->register($_POST['username'], $_POST['password']); } if (isset($_GET['logout'])) { // Logout Request $user_controller->logout(); }
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ include_once "includes/sp-load.php"; if (isLoggedIn() && $_GET['sec'] != 'logout') { redirectUrl(SP_WEBPATH . "/"); } include_once SP_CTRLPATH . "/user.ctrl.php"; $controller = new UserController(); $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":
<?php session_start(); require_once "../Reject.php"; require_once "../Controllers/UserController.php"; $permission = false; if (!Reject::hasAPIPermission()) { $user = $_POST['username']; $pass = $_POST['password']; if (isset($user) && isset($pass)) { if (UserController::login($user, $pass)) { $permission = true; } } } else { $permission = true; } if (!$permission) { echo 'Auth Failed'; exit; } if (!isset($_POST['function'])) { exit; } $function = json_decode($_POST['function']); if ($function['control'] == 'user') { if (isset($function['control']['add'])) { $users = json_decode($function['control']['add']); } }