public function __construct() { parent::__construct(); include 'controllers/loginController.php'; $valida = new login(); $valida->sessao_valida(); }
function login() { header("Content-type: text/html; charset=utf-8"); $username = $_POST['username']; $password = $_POST['password']; $database = new login(); $user_data = $database->get_user_info($username); $user_info = $user_data[0]; if ($user_info) { $realpass = md5($password); if ($realpass == $user_info['password']) { session_start(); $_SESSION['user'] = $username; $_SESSION['pass'] = md5($realpass); echo "<script>"; echo "window.location.href = '?c=admin'"; echo "</script>"; } else { //密码错误 echo "<script>"; echo "alert('用户名或密码错误');"; echo "window.location.href = '?c=login'"; echo "</script>"; } } else { //用户名错误 echo "<script>"; echo "alert('用户名或密码错误');"; echo "window.location.href = '?c=login'"; echo "</script>"; } }
public function run() { $login = new login(session::getSID()); if ($login->logged_in() === true) { header("Location: /index.php?logout=1"); } }
private function relogin() { $username = $_SESSION["username"]; $password = $_SESSION["password"]; session_destroy(); session_start(); require dirname(__FILE__) . "/login.php"; $login_controller = new login(); return $login_controller->attempt_login($username, $password); }
/** * Starts the Application * Takes the parts of the URL and loads the according controller & method and passes the parameter arguments to it * TODO: get rid of deep if/else nesting * TODO: make the hardcoded locations ("error/index", "index.php", new Index()) dynamic, maybe via config.php */ public function __construct() { $this->splitUrl(); // check for controller: is the url_controller NOT empty ? if ($this->url_controller) { // check for controller: does such a controller exist ? if (file_exists(CONTROLLER_PATH . $this->url_controller . '.php')) { // if so, then load this file and create this controller // example: if controller would be "car", then this line would translate into: $this->car = new car(); require CONTROLLER_PATH . $this->url_controller . '.php'; $this->url_controller = new $this->url_controller(); // check for method: does such a method exist in the controller ? if ($this->url_action) { if (method_exists($this->url_controller, $this->url_action)) { // call the method and pass the arguments to it if (isset($this->url_parameter_3)) { $this->url_controller->{$this->url_action}($this->url_parameter_1, $this->url_parameter_2, $this->url_parameter_3); } elseif (isset($this->url_parameter_2)) { $this->url_controller->{$this->url_action}($this->url_parameter_1, $this->url_parameter_2); } elseif (isset($this->url_parameter_1)) { $this->url_controller->{$this->url_action}($this->url_parameter_1); } else { // if no parameters given, just call the method without arguments $this->url_controller->{$this->url_action}(); } } else { // redirect user to error page (there's a controller for that) header('location: ' . URL . 'error/index'); } } else { // default/fallback: call the index() method of a selected controller $this->url_controller->index(); } // obviously mistyped controller name, therefore show 404 } else { // redirect user to error page (there's a controller for that) header('location: ' . URL . 'error/index'); } // if url_controller is empty, simply show the main page (index/index) } else { //redirect for entering page and not logged in if (isset($_SESSION['user_logged_in'])) { require CONTROLLER_PATH . 'login.php'; $controller = new login(); $controller->index(); } else { //redirect for entering page and logged in still require CONTROLLER_PATH . 'home.php'; $controller = new home(); $controller->index(); } } }
public function run() { $login = new login(session::getSID()); if ($login->logged_in() === true) { $user = new users(); $profilePicture = $user->getProfilePicture($_SESSION['userdata']['id']); $tpl = new template(); $tpl->assign("profilePicture", $profilePicture); $tpl->assign("userName", $_SESSION['userdata']['name']); $tpl->assign("userEmail", $_SESSION['userdata']['mail']); $tpl->display("general.loginInfo"); } }
public static function run() { new session(); //Suprimir Warnings error_reporting(E_WARNING); if (!isset($_SESSION['usuario'])) { if ($_GET['class']) { echo "\n\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\ttop.location='./';\n\t\t\t\t\t\t</script>\n\t\t\t\t\t"; } $pagina = new login(); $pagina->show(); } else { //$template = file_get_contents('app.view/template.class.php'); $template = new template(); ob_start(); $template->show(); $template = ob_get_contents(); ob_get_clean(); $content = ''; /* * Se tiver parametros na URL, carrega a classe */ if ($_GET) { $class = $_GET['class']; if (class_exists($class)) { $pagina = new $class(); ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } else { if (function_exists($method)) { call_user_func($method, $_GET); } } } else { $pagina = new home(); ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } /* * Susbstitui a string #CONTENT# do template para a pagina principal */ $site = str_replace('#CONTENT#', $content, $template); echo $site; } }
function checklogin() { $login = new login(); if (isset($_SESSION['user']) and isset($_SESSION['loged']) and isset($_SESSION['session']) and $_SESSION['loged'] == true) { include "body.php"; } else { $login->logwindow(); } if (isset($_GET['login']) and $_GET['login'] == "logout" and $_SESSION['loged'] == true) { $login->logout(); } if (isset($_POST['usuario']) and isset($_POST['senha']) and $_POST['usuario'] != "" and $_POST['senha'] != "" and isset($_SESSION['cod_usuario']) == false) { $login->login(); } }
public function validalogin() { $login = new login(); $username = $_REQUEST['username']; $password = $_REQUEST['password']; $validar = $login->validacion($username, $password); if ($validar == 0) { echo "<script>alert('El usuario y contrasena son incorrectas')</script>"; echo '<meta http-equiv="refresh" content="0; url="/>'; } elseif ($validar == 1) { $_SESSION['username'] = $username; $_SESSION['password'] = $password; echo '<meta http-equiv="refresh" content="0; url="/>'; } }
/** * Opprett objekt av en bruker * @param integer $u_id * @param boolean $is_login_user settes kun av login klassen */ public function __construct($u_id, $is_login_user = false) { global $_base, $_game; $u_id = (int) $u_id; $this->id = $u_id; // hent brukerdata $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT users.*\n\t\t\tFROM users\n\t\t\tWHERE users.u_id = {$u_id}"); // lagre data $this->data = $result->fetch(); unset($result); // fant ikke brukeren? if (!$this->data) { return; } // levende/aktivert? $this->active = $this->data['u_access_level'] != 0; // koble mot login? if ($is_login_user) { login::$user = $this; } // fjern variablene som skal lastes når de blir benyttet unset($this->params); unset($this->player); unset($this->lock); unset($this->lock_state); return; }
public function __construct() { define("BASE_LOADED", true); // starter utdata buffer ob_start(); // hent essenntials require "essentials.php"; ess::$b->base = $this; // kjør scheduler if (!MAIN_SERVER) { $this->scheduler(); } ess::$b->dt("load_es-gu_pre"); // hent inn brukerinformasjon login::init(); ess::$b->dt("post"); // sjekk ssl $this->check_ssl(); // brukerstæsj if (login::$logged_in) { $this->load_user_stuff(); } else { $this->update_anon_stats(); } // logg visning $this->log_request(); // sjekk referer $this->check_referer(); define("SCRIPT_TIME_HALF", microtime(true) - SCRIPT_START); $profiler = \Kofradia\DB::getProfiler(); define("QUERIES_TIME_HALF", $profiler ? $profiler->time : null); define("QUERIES_NUM_HALF", $profiler ? $profiler->num : null); $this->load_config(); ess::$b->dt("base_loaded"); }
public static function main() { //odczytanie __CLASS__ nie moze byc w funkcji w klasie nadrzędnej if (basename($_SERVER["SCRIPT_NAME"]) == __CLASS__ . ".php") { login::display(__CLASS__); } }
public function __construct() { socialFeed::get_favicon_from('http://www.delicious.com/sydlawrence'); $this->session = Session::instance(); $this->db = new Database(); parent::__construct(); $_POST = $this->input->xss_clean($_POST); if ($this->input->post('attempt_login')) { $return = login::attempt_login(); if (isset($return->id) && $return->id > 0) { $this->user = $return; } else { $this->__set_options(array('error' => $return)); } if (isset($_GET['redirect'])) { url::redirect(urldecode($_GET['redirect'])); } } $this->user = login::check_login(); if ($this->input->get('logout')) { Auth::instance()->logout(TRUE); url::redirect(); } $this->page = Page_Model::get_by_url(); $this->feed = Feed_Model::get_by_url(); $this->feedpost = Feedpost_Model::get_by_url(); $this->__setup(); $this->header = new View('includes/header'); $this->footer = new View('includes/footer'); $this->__binds(); }
function login($user, $pswd) { $login = new login(); //var_dump($login); $login->SetUsername($user); $login->SetPassword($pswd); $error = $login->CheckLogin(); //echo $error; if (isset($_SESSION['ExtDeskSession']['username'])) { $res["success"] = TRUE; $res["msg"] = "user {$_SESSION['ExtDeskSession']['username']} loged in "; } else { $res["success"] = FALSE; $res["msg"] = "Not login"; } return $res; }
public function validalogin() { $login = new login(); $username = $_REQUEST['username']; $password = $_REQUEST['password']; $validar = $login->validacion($username, $password); if ($validar == 0) { echo "<script>alert('El usuario y contrasena son incorrectas')</script>"; echo '<meta http-equiv="refresh" content="0; url="/>'; } elseif ($validar == 1) { $informacion = $login->loadUsuario($username); $_SESSION['usu_id'] = $informacion[0]['pk_usu_id']; $_SESSION['usu_username'] = $informacion[0]['usu_username']; $_SESSION['name'] = $informacion[0]['usu_primer_nombre']; $_SESSION['lastname'] = $informacion[0]['usu_primer_apellido']; echo '<meta http-equiv="refresh" content="0; url="/>'; } }
function loginClient() { $objectLogin = new login(); $dbConnectionArray = $objectLogin->getDatbaseConnectionDetails(); try { $dbHost = $dbConnectionArray['dbHost']; $dbName = $dbConnectionArray['dbName']; $dbUser = $dbConnectionArray['dbUser']; $dbPassword = $dbConnectionArray['dbPassword']; //connect to database $pdo = new PDO("mysql:host={$dbHost};dbname={$dbName}", $dbUser, $dbPassword); $userName = $_POST['username']; //validate login details $loginQuery = $pdo->prepare("SELECT username,password,salt,sitename FROM dw_clients WHERE username = '******'"); $loginQuery->execute(); $loginCount = count($loginQuery); if ($loginCount > 0) { $password = $_POST['password']; //cleartext password entered via the form $resultSet = $loginQuery->fetchAll(); $usernameDB = $resultSet[0]['username']; $passwordDB = $resultSet[0]['password']; $salt = $resultSet[0]['salt']; $sitename = $resultSet[0]['sitename']; $hash = $objectLogin->hashPassword($password, $salt); //returns the hashedPassword if ($hash == $passwordDB && $userName == $usernameDB) { //create session session_start(); $_SESSION["website"] = $sitename; $_SESSION['lastActivity'] = time(); //redirect to the subdomain header("Location:http://www.example.com.ie/client/{$sitename}"); } else { //fail to login //redirect to the login form header("Location:http://www.example.com/login"); } } } catch (Exception $e) { } }
public function delete() { $log = ORM::factory('activity'); $log->user_id = login::check_login()->id; $log->item_type = $this->object_name; $log->item_id = $this->id; $log->activity_type = "delete"; $log->item_old = serialize($this); $log->save(); return parent::delete(); }
/** * start - renders applicaiton and routes to correct template, writes content to output buffer * * @access public static * @return void */ public function start() { $config = new config(); $login = new login(session::getSID()); $frontController = frontcontroller::getInstance(ROOT); if ($login->logged_in() === false) { if (isset($_GET['export']) === true) { ob_start(); $frontController->run(); $toRender = ob_get_clean(); } else { ob_start(); include 'includes/templates/' . TEMPLATE . '/login.php'; $toRender = ob_get_clean(); } } else { ob_start(); include 'includes/templates/' . TEMPLATE . '/content.php'; $toRender = ob_get_clean(); } $this->render($toRender); }
public function run() { $login = new login(session::getSID()); if ($login->logged_in() === true) { $tpl = new template(); //Messages $message = new messages(); $messages = $message->getInbox($_SESSION['userdata']['id'], 5, 0); $messageCount = count($messages); if ($messageCount) { $mailOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#'); } else { $mailOptions = array('class' => 'dropdown-toggle'); } $tpl->assign("mailOptions", $mailOptions); $tpl->assign("messagecount", $messageCount); $tpl->assign("messages", $messages); $tpl->assign("helper", new helper()); //Tickets $tickets = new tickets(); $newTickets = $tickets->getUnreadTickets($_SESSION['userdata']['id']); $ticketCount = count($newTickets); if (count($newTickets)) { $ticketOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#'); } else { $ticketOptions = array('class' => 'dropdown-toggle'); } if (is_array($newTickets) === true) { $limitedTicketItems = array_slice($newTickets, 0, 5); } else { $limitedTicketItems = array(); } $tpl->assign("tickeOptions", $ticketOptions); $tpl->assign("ticketCount", $ticketCount); $tpl->assign("newTickets", $limitedTicketItems); $tpl->display("general.headMenu"); } }
public function index() { $this->template->title = "Please login"; $this->template->content = new View('zest/login_content'); $version = zest::get_version(TRUE); $this->template->version = $version; $return = login::attempt_login(); if (isset($return->id)) { if ($return->roles[0]->id == 4) { $this->template->message = "You do not have access to this area of the site"; } else { url::redirect('admin'); } } else { $this->template->message = $return; } }
public function get_LoginStatus() { // $status=$_COOKIE['status']; // $sql="select*from users where status='$status'"; // $row=new dbconnect(); // $row=$row->connect($sql); // echo $status; // print_r($row); // if($status!=$row['status']||$status==""){ // $code="406"; // $msg="error:Failure login status!"; // $data="null"; // $result=api_response::api_method($type,$code,$msg,$data); // } // else{ $result = login::get_info(); // } return $result; }
public static function render_form() { $form = ""; if (isset($_POST['forgotten_email'])) { $user = ORM::factory('user', $_POST['forgotten_email']); if ($user->id > 0) { $user->reset_password(); $form .= "<span id='login_error' style='color:red'>Your new password has been emailed to you.</span>"; } else { $form .= "<span id='login_error' style='color:red'>That email is not registered with us.</span>"; } } $user = login::attempt_login(); if (is_object($user)) { return "hello " . $user->username . " <a href='?logout'>logout</a>"; } if (is_string($user)) { $form .= "<span id='login_error' style='color:red'>{$user}</span>"; } $form .= '<span id="forgotten_password" class="hide">'; $form .= '<label for="forgotten_email">Email</label>'; $form .= '<input type="text" name="forgotten_email" value="email" onfocus="if (this.value=\\"email\\") this.value=\\"\\""/>'; $form .= '<input type="submit" value="login" class="submit" />'; $form .= form::close(); $form .= '</span>'; $form .= '<span id="login_form" class="hide">'; $form .= form::open(); $form .= '<label for="username">Username</label>'; $form .= '<input type="text" name="username" value="username" onfocus="if (this.value=\\"username\\") this.value=\\"\\""/>'; $form .= '<label for="password">Password</label>'; $form .= '<input type="password" name="password" value="password" onfocus="if (this.value=\\"password\\") this.value=\\"\\""/>'; $form .= '<input type="submit" value="login" class="submit" />'; $form .= form::close(); $form .= '<a href="#" onclick="$(\'#forgotten_password\').show();$(\'#login_form\').hide()">forgotten password?</a>'; $form .= '</span>'; return $form; }
} $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : ''; $user = user::getInstance(); if (!$user->logged_in() && $mode != 'register') { $mode = 'login'; } $userlogged = $user->logged_in(); $modes = $mode ? explode('.', $mode) : array(); $modes = array_slice($modes, 0, 2); $wmode = implode('.', $modes); // Traitement des modes $html = false; switch ($wmode) { case 'login': include 'controllers/login.class.php'; $controller = new login(); $controller->set_mode($mode); $html = $controller->process(); break; case 'register': include 'controllers/register.class.php'; $controller = new register(); $controller->set_mode($mode); $html = $controller->process(); break; case 'logout': $user->set_logout(); redirect(''); break; case 'profile': include 'controllers/edit.class.php';
/** * Funcao run * Carrega conteudo da pagina * * @access public * @return void */ public static function run() { //Suprimir Warnings //error_reporting(E_WARNING); new TSession(1); //Não tem Usuario ativo if (!isset($_SESSION['usuario'])) { $pagina = new login(); $pagina->show(); } else { //$template = file_get_contents('app.view/template.class.php'); $template = new template(); ob_start(); $template->show(); $template = ob_get_contents(); ob_get_clean(); $content = ''; /* * Se tiver parametros na URL, carrega a classe */ if ($_GET) { $class = urldecode($_GET['class']); if (class_exists($class)) { if (isset($_GET['funcao'])) { $funcao = $_GET['funcao']; $class = $class . '_' . $funcao; if (class_exists($class)) { $pagina = new $class(); } else { $pagina = new erro(); $pagina->codigo = 404; ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } } else { $pagina = new $class(); } ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } else { $pagina = new erro(); $pagina->codigo = 404; ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } } else { $pagina = new home(); ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } /* * Susbstitui a string #CONTENT# do template para a pagina principal */ $site = str_replace('#CONTENT#', $content, $template); echo $site; } }
<?php if (!isset($_SESSION)) { session_start(); } require "checklogin.php"; $user = $_SESSION['username']; $pass = $_SESSION['password']; $level = $_SESSION['level']; $name = $_SESSION['name']; $email = $_SESSION['email']; include "libvirt.class"; $libvirt = new libvirt(); include "login.class"; $login = new login(); if ($level != "admin") { echo "<script>location.replace(\"{$_SESSION['destination']}\")</script>"; } ?> <html> <head> <title>Admin Dashboard</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/jquery.gritter.css" /> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript">google.load('jquery', '1.5');</script> <script type="text/javascript" src="js/jquery.gritter.min.js"></script> <script type="text/javascript" src="js/jquery-1.11.2.js"></script> <script type="text/javascript" src="js/bootstrap.min"></script> <link rel="stylesheet" type="text/css" href="css/style1.css"/>
<?php session_start(); include "php/login.php"; $login = new login(); $login->checklogin(); if (isset($_SESSION['loged']) and $_SESSION['loged'] == true) { ?> <head> <title>sistema.osuc.org.br</title> <meta name="viewport" content="width=device-width"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <link rel="stylesheet" href="js/uikit/css/uikit.css" /> <link rel="stylesheet" href="js/uikit/css/uikit.avenue.css" /> <link rel="stylesheet" href="js/uikit/css/uikit.theme.css" /> </head> <?php if (isset($_GET['cod_empresa'])) { $cod_empresa = $_GET['cod_empresa']; } else { $cod_empresa = ""; } $cadastro = new cadastro(); $cadastro->cad_empresas($cod_empresa); ?> <div class="uk-width-4-5 uk-container-center uk-text-center "> <div class="uk-grid ">
<?php if (isset($_POST['username']) && strlen($_POST['username']) >= 5 && strlen($_POST['username'] <= 10) && isset($_POST['password']) && (strlen($_POST['password']) >= 5 && strlen($_POST['password']) <= 10)) { require 'login.php'; $objectLogin = new login(); $loginClient = $objectLogin->loginClient(); }
public function login_interface() { parent::login(); }
<?php include_once $_SERVER['DATING_ROOT'] . '/lib/init-global.php'; abstract class login extends \lib\actions { public static function post() { if ($user = \lib\user::authenticate($_POST['username'], $_POST['password'])) { $_SESSION['user_id'] = $user['id']; return true; } else { return false; } } } login::run();
<?php // Basic include "config.php"; // Classes include "class/synchro.class.php"; include "class/version.class.php"; include "class/login.class.php"; login::check(); // Check if there are change-requests if (isset($_POST["changepass"])) { Synchro::settingSet("password.txt", $_POST["changepass"]); sndmail("Password changed", "We just wanted to quickly inform you, that somebody just changed your Synchro password. If you are this person you can relax, otherwise change save your files!"); echo "Changed Password."; } if (isset($_POST["changeuser"])) { Synchro::settingSet("username.txt", $_POST["changeuser"]); sndmail("Username changed", "We just wanted to quickly inform you, that somebody just changed your Synchro username. If you are this person you can relax, otherwise change save your files!"); echo "Changed Username."; } if (isset($_POST["changemail"])) { Synchro::settingSet("mail.txt", $_POST["changemail"]); sndmail("Mail changed", "Hello! If you got this mail, you have successfully changed your mail in synchro."); echo "Changed Mail."; } if (isset($_POST["changedomain"])) { Synchro::settingSet("domain.txt", $_POST["changedomain"]); sndmail("Domain changed", "We just wanted to quickly inform you, that somebody just changed your Synchro domain."); echo "Changed Domain."; } $user = Synchro::getSettingValue("username.txt");