protected function myAccount() { Login::checkLogin(); $this->myView = new LoginMyAccountView(); $this->myModel = new AccountModel(); // Transfere o ID do usuário logado $this->id = $_SESSION['webLogin']->getUserID(); $this->detail(); // Cria ligação com a visão de fotos e endereço $this->myView->bindAddressDetailView(); $this->myView->bindPhotoSingleUploadView('avatar'); }
function process($parameters) { $login = new Login(); //user is already logged if ($login->checkLogin() != 0) { $this->messages[] = ['s' => 'info', 'cs' => 'Už jsi přihlášen', 'en' => 'You are already logged']; $this->redirect(''); } if (isset($_POST['sent'])) { $data = $login->sanitize(['login' => $_POST['login'], 'p' => $_POST['p']]); $result = $login->tryLogin($data, $this->language); if ($result['s'] == 'success') { $this->redirect('payments'); } else { $this->messages[] = $result; } $this->data = $data; //for autofilling inputs from previous page } $this->header['title'] = ['cs' => 'Přihlášení', 'en' => 'Login']; $this->view = 'login'; }
<?php require 'php/login.php'; $login = new Login(); if ($login->checkLogin($_POST['nick'], $_POST['pw'])) { echo 'true'; } else { echo 'false'; }
public function process() { // check if session is active $session = new Session($this->sessionId); if ($session->sessionId > 0) { // update session $session->update(); // process restricted functions switch ($this->f) { case 'checkLogin': return Login::checkLogin($session->sessionId); case 'getSession': return $session; case 'getWarehouse': if (isset($this->data->update)) { $warehouse = new Warehouse($session->warehouseId, $this->data->update); } else { $warehouse = new Warehouse($session->warehouseId); } $warehouse->dMail = $warehouse->getMail(); $warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled(); $warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled(); return $warehouse; case 'editWarehouse': if (!$session->restricted) { $data = $this->data; $warehouse = new Warehouse($session->warehouseId); // update warehouse data if (isset($data->name)) { $warehouse->name = $data->name; } if (isset($data->description)) { $warehouse->description = $data->description; } if (isset($data->country)) { $warehouse->country = $data->country; } if (isset($data->city)) { $warehouse->city = $data->city; } if (isset($data->password)) { $warehouse->setPassword($data->password); } if (isset($data->passwordRestricted)) { $warehouse->setPasswordRestricted($data->passwordRestricted); } if (isset($data->mail)) { $warehouse->setMail($data->mail); } if (isset($data->disableLocationLess)) { $warehouse->setDisableLocationLess($data->disableLocationLess); } if (isset($data->disablePaletteLess)) { $warehouse->setDisablePaletteLess($data->disablePaletteLess); } // update database entry return $warehouse->edit(); } break; case 'deleteWarehouse': if (!$session->restricted) { $warehouse = new Warehouse($session->warehouseId); if ($warehouse->id > 0 && $warehouse->delete()) { return $session->destroy(); } } break; case 'addCategory': if (!$session->restricted && isset($this->data->name)) { $category = new Category(null, $session->warehouseId); $category->name = $this->data->name; if (isset($this->data->parent)) { $category->parent = $this->data->parent; } if ($category->edit()) { return $category->id; } } break; case 'getCategory': if (isset($this->data->id) && isset($this->data->update)) { return new Category($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Category($this->data->id, $session->warehouseId); } break; case 'deleteCategory': if (!$session->restricted && isset($this->data->id)) { $category = new Category($this->data->id, $session->warehouseId); return $category->delete(); } break; case 'editCategory': if (isset($this->data->id)) { $data = $this->data; $category = new Category($this->data->id, $session->warehouseId); if (!$session->restricted) { if (isset($data->name)) { $category->name = $data->name; } if (isset($data->parent)) { $category->parent = $data->parent; } if (isset($data->male)) { $category->male = $data->male; } if (isset($data->female)) { $category->female = $data->female; } if (isset($data->children)) { $category->children = $data->children; } if (isset($data->baby)) { $category->baby = $data->baby; } if (isset($data->summer)) { $category->summer = $data->summer; } if (isset($data->winter)) { $category->winter = $data->winter; } } if (isset($data->demand)) { $category->demand = $data->demand; } if (isset($data->weight)) { $category->weight = $data->weight; } return $category->edit(); } break; case 'getCategories': if (isset($this->data->parent)) { return Category::getCategories($session->warehouseId, $this->data->parent); } else { return Category::getCategories($session->warehouseId); } case 'addLocation': if (!$session->restricted && isset($this->data->name)) { $location = new Location(null, $session->warehouseId); $location->name = $this->data->name; if ($location->edit()) { return $location->id; } return true; } break; case 'getLocation': if (isset($this->data->id) && isset($this->data->update)) { return new Location($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Location($this->data->id, $session->warehouseId); } break; case 'deleteLocation': if (!$session->restricted && isset($this->data->id)) { $location = new Location($this->data->id, $session->warehouseId); return $location->delete(); } break; case 'editLocation': if (!$session->restricted && isset($this->data->id) && isset($this->data->name)) { $location = new Location($this->data->id, $session->warehouseId); $location->name = $this->data->name; return $location->edit(); } break; case 'getLocations': return Location::getLocations($session->warehouseId); case 'addPalette': $palette = new Palette(null, $session->warehouseId); if (isset($this->data->locationId)) { $palette->locationId = $this->data->locationId; } if ($palette->edit()) { return $palette->id; } break; case 'getPalette': if (isset($this->data->id) && isset($this->data->update)) { return new Palette($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Palette($this->data->id, $session->warehouseId); } break; case 'deletePalette': if (isset($this->data->id)) { $palette = new Palette($this->data->id, $session->warehouseId); return $palette->delete(); } break; case 'editPalette': if (isset($this->data->id)) { $palette = new Palette($this->data->id, $session->warehouseId); if (isset($this->data->locationId)) { $palette->locationId = $this->data->locationId; } return $palette->edit(); } break; case 'getPalettes': return Palette::getPalettes($session->warehouseId); case 'getCarton': if (isset($this->data->id) && isset($this->data->update)) { return new Carton($this->data->id, $session->warehouseId, null, null, $this->data->update); } elseif (isset($this->data->id)) { return new Carton($this->data->id, $session->warehouseId); } break; case 'addCarton': $locationId = null; $paletteId = null; if (isset($this->data->location)) { $locationId = $this->data->location; } if (isset($this->data->palette)) { $paletteId = $this->data->palette; } $carton = new Carton(null, $session->warehouseId, $locationId, $paletteId); return $carton->id; case 'deleteCarton': if (isset($this->data->id)) { $carton = new Carton($this->data->id, $session->warehouseId); return $carton->delete(); } break; case 'editCarton': if (isset($this->data->id)) { $carton = new Carton($this->data->id, $session->warehouseId); if (isset($this->data->location)) { $carton->locationId = $this->data->location; } else { $carton->locationId = null; } if (isset($this->data->palette)) { $carton->paletteId = $this->data->palette; } else { $carton->paletteId = null; } return $carton->edit(); } break; case 'addArticle': if (isset($this->data->carton) && isset($this->data->category) && isset($this->data->amount)) { return Stock::addArticle($this->data->carton, $this->data->category, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->baby : false, isset($this->data->winter) ? $this->data->winter : false, isset($this->data->summer) ? $this->data->summer : false, $this->data->amount >= 0 ? $this->data->amount : 0, $this->data->amount < 0 ? $this->data->amount : 0); } break; case 'getStock': return Stock::getStock($session->warehouseId, isset($this->data->carton) ? $this->data->carton : null, isset($this->data->category) ? $this->data->category : null, isset($this->data->palette) ? $this->data->palette : null, isset($this->data->location) ? $this->data->location : null, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->male : false, isset($this->data->summer) ? $this->data->male : false, isset($this->data->winter) ? $this->data->male : false, isset($this->data->details) ? $this->data->details : false); case 'getBarcodeUri': if (isset($this->data->text)) { // create barcode object $bc = new Barcode39($this->data->text); if (isset($this->data->textSize)) { $bc->barcode_text_size = $this->data->textSize; } if (isset($this->data->barThin)) { $bc->barcode_bar_thin = $this->data->barThin; } if (isset($this->data->barThick)) { $bc->barcode_bar_thick = $this->data->barThick; } // generate barcode image $img = "barcode_" . mt_rand(0, 100) . ".png"; $bc->draw($img); // get data uri $uri = Barcode39::getDataURI($img); unlink($img); return $uri; } break; } } else { // process unrestricted function switch ($this->f) { case 'getActiveSessions': return Session::getActiveSessionsNumber(); case 'getWarehouses': return Warehouse::getWarehouses(); case 'addWarehouse': $data = $this->data; if (isset($data->name) && isset($data->description) && isset($data->country) && isset($data->city) && isset($data->password) && isset($data->mail)) { $warehouse = new Warehouse(); Log::debug('new warehouse' . $warehouse->id); $warehouse->name = $data->name; $warehouse->description = $data->description; $warehouse->country = $data->country; $warehouse->city = $data->city; $warehouse->setPassword($data->password); $warehouse->setMail($data->mail); return $warehouse->edit(); } break; case 'getCountries': return getCountries(); break; case 'getCountryCode': $data = $this->data; if (isset($data->name)) { return getCountryCode(null, $data->name); } return false; } } return false; }
<html> <body> <div id="logindiv"> <div id="login"> <form method="POST" name="login" action="loginform.php" id="login"> <p>Username</p> <p><input type="text" id="username" name="username"/></p> <p>Password</p> <p><input type="password" id="password" name="password"/></p> <p><input type="submit" name="logged" id="logged" value="Login"/></p> </form> </div> </div> </body> </html> <?php // Form processing engine goes here! if ($_POST) { extract($_POST); $login = new Login(); $status = $login->checkLogin($username, $password); if (!$status) { echo "<script>loginShow('true')</script>"; } else { header("Location:../index.php"); exit; } } else { echo "<script>loginShow(true)</script>"; }
session_start(); class Login { public $username; protected $password; public function __construct($username, $password) { $this->username = $username; $this->password = $password; } public function checkLogin() { $db = new Database(); $con = $db->connectDB(); $result = $con->query("SELECT gebruikerId FROM gebruikers WHERE gebruikersnaam = '{$this->username}' AND wachtwoord = '{$this->password}' LIMIT 1"); if ($result->num_rows == 1) { return true; } else { return false; } } } if (isset($_POST['Submit'])) { $login = new Login($_POST['Username'], $_POST['Password']); if ($login->checkLogin()) { $_SESSION['username'] = $_POST['Username']; header("Location: index.php"); } else { echo 'Fout bij inloggen.'; } }
<?php $loginerr = ''; session_start(); require_once "include/config.inc.php"; require_once "dal/db.cls.php"; require_once "bl/login.cls.php"; if ($_POST['loginsubmit']) { $login = new Login(); $row = $login->checkLogin($_POST['txtusername'], $_POST['txtpassword']); if ($row == false) { $loginerr = $login->msg; } else { header("Location:index.php"); } } ?> <html><head> <title>Please Login - Student Information and Management system</title> <link rel="stylesheet" type="text/css" href="styles/login.css" /> </head><body> <form id='login' name='login' action="<?php echo $PHP_SELF; ?> " method="POST"> <div class="login_wrapper"> <div class="topbar"> <div class="logo"></div> <div class="desc">Student Information and Management System</div>
protected function ajaxCallbackForPay() { if (Login::checkLogin(false)) { $json['message']['type'] = "warning"; $json['message']['text'] = Text::read('message.order.needLogin'); } else { $this->myView->data = $this->myModel->selectForDetail($this->myView->data->id); if ($this->myView->data) { // Seleciona dados do produto e da conta que realizou a compra $account = $this->myModel->buyerModel->selectForDetail($this->myView->data->buyer); $product = $this->myModel->productModel->selectForDetail($this->myView->data->product); // Preenche dados para criação da transação CreatePaymentRequest::setOrderData($this->myView->data); CreatePaymentRequest::setAccountData($account); CreatePaymentRequest::setProductData($product); $json['redirect'] = CreatePaymentRequest::main(); } else { $json['message']['type'] = "error"; $json['message']['text'] = Text::read('message.order.orderError'); } } return $json; }
<?php session_start(); require_once '../_app/config.inc.php'; // SETS LOGIN AND LOGOFF $login = new Login(1); $logoff = filter_input(INPUT_GET, 'logoff', FILTER_VALIDATE_BOOLEAN); $getexe = filter_input(INPUT_GET, 'exe', FILTER_DEFAULT); // VERIFIES LOGIN if (!$login->checkLogin()) { unset($_SESSION['userLogin']); header('Location: index.php?exe=restricted'); } else { $userLogin = $_SESSION['userLogin']; } // VERIFIES LOGOFF if ($logoff) { unset($_SESSION['userLogin']); header('Location: index.php?exe=logoff'); } ?> <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <h1>Painel</h1> <a href="panel.php?logoff=true">Log off</a>
protected function create() { Login::checkLogin(); $this->myView = new ProductCreateView(); $this->myModel = new ProductModel(); $this->__detail(); // Verifica se o produto pertence ao criador if ($this->id && $this->myView->data->account != $_SESSION['webLogin']->getUserID()) { header("location: " . Config::read('page.url.homepage')); } // Verifica se o produto já foi aprovado e bloqueia alterações if ($this->myView->data->status == Config::read('product.status')['approved']) { // Cria ligação com a visão de fotos $this->myView->bindPhotoReadOnlyView(); // Desabilita todos os campos do formulário $this->myView->globalDisabled = true; } else { // Cria ligação com a visão de fotos $this->myView->bindPhotoMultipleUploadView('product'); } // Seleciona combo de tipos e marcas $this->myView->comboType = $this->myModel->typeModel->selectComboType(); $this->myView->comboSubType = $this->myModel->typeModel->selectChildComboType($this->myView->data->type); $this->myView->comboBrand = $this->myModel->brandModel->selectComboBrand(); }
protected function remove() { Login::checkLogin(); $this->myModel = new InboxModel(); $this->__remove(); }
<?php // cross domain login if (!Login::isLoggedIn() && $_GET['login_username'] && $_GET['login_password']) { $o = new Login($_GET['login_username'], $_GET['login_password'], $_GET['remember_me']); $re = $o->checkLogin(); if ($re['status'] == 'OK') { $o->doLogin(); } } //header('Access-Control-Allow-Origin: *'); //header("Access-Control-Allow-Headers: x-requested-with"); header("Content-type: text/javascript"); ?> check_login('<?php echo is_numeric(PERSON_ID) ? 'true' : 'false'; ?> ');
<?php // Form processing engine goes here! if (isset($_POST) and isset($_POST['username']) and isset($_POST['password'])) { $login = new Login(); $status = $login->checkLogin($_POST['username'], $_POST['password']); if ($status) { header("Location:../index.php"); } else { // header("Location:index.php"); exit; } } else { exit; } ?>
<?php /** * Created by PhpStorm. * User: ununik * Date: 17.08.2015 * Time: 15:50 */ $login = ""; $err = array(); if (isset($_POST['login'])) { $checkLogin = new Login(); if (!$checkLogin->checkLogin(safeText($_POST['login']), safeText($_POST['password']))) { $err[] = "Špatné jméno nebo heslo!"; } elseif (!$checkLogin->getValidate()) { $err[] = "Účet stále nebyl validován pomocí kódu, který Vám přišel emailu!"; } if (empty($err)) { header("Location: index.php?page=home"); } } return include_once "views/login/login-html.php";