private static function handleLogin() { if (!isset($_POST['login'])) { return; } $user = new User($_POST['user'], $_POST['pass']); $cookies = Net::startSession(); $user->setCaptcha($_POST['gid'] ?: -1, $_POST['captcha'] ?: '')->setEmailSteamId($_POST['emailsteamid'] ?: '')->setTwoFactorCode($_POST['2fa'] ?: ''); $loginData = $user->doLogin($cookies); if (!$loginData['success']) { return $loginData; } $hasPhone = $loginData['oauth']->hasPhone(); if (!$hasPhone) { return ['phone_needed' => true]; } $authData = $loginData['oauth']->addAuthenticator(); $authData = array_merge($authData, ['access_token' => $loginData['oauth']->oauth_token, 'wgtoken' => $loginData['oauth']->wgtoken, 'wgtoken_secure' => $loginData['oauth']->wgtoken_secure, 'steamid' => $loginData['oauth']->steamid]); return ['sms_needed' => true, 'revocation_code' => $authData['revocation_code'], 'authdata' => Crypt::encrypt($authData, $_POST['ekey']), 'raw' => $authData]; }
<?php /** * Admin side Login file * * * @version 1.0 * @package LySoft * */ $login_error = ''; if ($_REQUEST['submit']) { if ($_REQUEST['email'] || $_REQUEST['email'] != '') { $user_name = _escape($_REQUEST['email']); $password = _escape($_REQUEST['password']); if (User::doLogin($user_name, $password)) { User::setSession($user_name); } else { //$error = "Invalid Login"; $login_error = 1; } } else { //$error = "Invalid Login"; $login_error = 1; } } if (isset($_SESSION['user'])) { _R(lr('pipedrive-dashboard-source')); } //$login_action_url = lr('login'); $no_visible_elements = true;
if (!Tools::verifyEmail($email)) { $formValid = false; $errors["email"] = "You must insert a valid email."; } // Si mot de passe valide if (!Tools::verifyPassword($pwd)) { $formValid = false; $errors["pwd"] = "You must insert a valid password see password hint."; } // Vérifie si le champs URL contient une information if (!isset($url) || $url == $_SERVER["PHP_SELF"] || true) { $url = $HOME; } // if ($formValid) { if (!User::doLogin($email, $pwd)) { $formValid = false; $errors["other"] = "Login failed, credential invalid."; } else { // header('Location: '. $url, true, 302); header("Location: " . $url); exit; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>STI 2</title>
<?php session_start(); require_once "../model/models.php"; $controllerCalled = 1; $login = new User(); if ($login->is_loggedin() != "") { $login->redirect('dashboard.php'); } if (isset($_POST['btn-login'])) { $uname = strip_tags($_POST['username']); $umail = strip_tags($_POST['username']); $upass = strip_tags($_POST['password']); if ($login->doLogin($uname, $umail, $upass)) { $login->redirect('dashboard.php'); } else { $error = "Wrong Details !"; } } include "../vue/login.php";
<?php include "core/init.php"; $topic = new Topic(); error_reporting(E_ALL & ~E_NOTICE); ini_set('error_reporting', E_ALL); $template = new Template("templates/home.php"); if (isset($_POST['do_login'])) { $user = new User(); $username = $_POST['username']; $password = md5(md5($_POST['password'])); if ($user->doLogin($username, $password)) { redirect(false, "Successfully Logged In.", "success"); } else { redirect("home.php", "Failed to login. Use proper login credentials.", "error"); } } echo $template;
if (version_compare(phpversion(), '5.5.0', '<')) { require_once 'password.php'; } // Establishing the database connection try { $db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8', DB_USER, DB_PASSWORD, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); } catch (PDOException $ex) { echo "Database connection failed: " . $ex->getMessage(); exit; } // Creating the Eve class object $eve = new Eve($db); // Scrubbing the HTTP headers to get the user's IP Address $headers = getallheaders(); // Checking the headers to see if the traffic is coming through a proxy such as CloudFlare or direct if (isset($headers['X-Forwarded-For'])) { $ip = $headers['X-Forwarded-For']; } else { $ip = $_SERVER['REMOTE_ADDR']; } // Doing the login functionality of a login POST attempt is found if (isset($_POST['login'])) { if (BRUTE_MODE) { User::doLogin($_POST['username'], $_POST['password'], User::bruteCheck($ip, $db), $ip, $db); } else { User::doLogin($_POST['username'], $_POST['password'], TRUE, $ip, $db); } } // Creating the user class object $user = new User($db); $settings = new Settings($db, $user->getGroup());
$com_key = ''; if (!empty($_SESSION['com_key'])) { $com_key = $_SESSION['com_key']; } if (!empty($_POST['com_key'])) { $com_key = $_POST['com_key']; } if ($returndata['success'] == 1) { dbconn::insert_new_comkey($returndata['user_id'], $com_key); } break; #網站登入 #網站登入 case 'web_login': //登入 $returndata = User::doLogin($_POST); $com_key = ''; if (!empty($_SESSION['com_key'])) { $com_key = $_SESSION['com_key']; } if (!empty($_POST['com_key'])) { $com_key = $_POST['com_key']; } if ($returndata['success'] == 1) { dbconn::insert_new_comkey($returndata['user_id'], $com_key); dbconn::insert_login_makekey($returndata['user_id'], $com_key, 0); } break; #Google登入 #Google登入 case 'google_callback':
require "model.php"; DB::setDB("sample.db"); DB::setDriver("sqlite"); try { DB::begin(); for ($i = 0; $i < 100; $i++) { $user = new User(array("user" => "foobar{$i}", "pass" => "nothing")); $user->save(); } DB::commit(); } catch (PDOException $e) { /* probably the table is already populated */ DB::rollback(); } /* Load users with `user` foobar1 or foobar2 and change its password */ $users = new User(); $users->user = array("foobar1", "foobar2"); DB::begin(); foreach ($users->load() as $user) { $user->pass = "******"; $user->save(); } DB::commit(); /* now let's try some queries, the first should work, the other should fail */ foreach (array("foobar1" => "pass", "foobar10" => "pass") as $user => $pass) { if (User::doLogin($user, $pass)) { print "Welcome user {$user}\n"; } else { print "Bad username or password ({$user})\n"; } }
require "resources/libs/class.phpmailer.php"; if (!isset($_GET["op"])) { die(json_encode(array("status" => "ERROR", "msg" => "No tienes permitido hacer eso"))); } if (isset($_SESSION["uid"])) { $user = new User($_SESSION["uid"]); } else { $user = new User(); } switch ($_GET["op"]) { case "login": if ($user->getUID()) { die(json_encode(array("status" => "ERROR", "msg" => "No tienes permitido hacer eso"))); } if (isset($_POST["username"]) && isset($_POST["password"]) && ($_POST["username"] != "" && $_POST["password"] != "")) { if ($user->doLogin(htmlspecialchars($_POST["username"], ENT_QUOTES, 'UTF-8'), htmlspecialchars($_POST["password"], ENT_QUOTES, 'UTF-8'))) { die(json_encode(array("status" => "OK", "data" => array("userid" => $user->getUID(), "sessionid" => $user->getSessionID())))); } else { die(json_encode(array("status" => "ERROR", "msg" => "El usuario/email o la contraseña no coinciden"))); } } else { die(json_encode(array("status" => "ERROR", "msg" => "El usuario/email y la contraseña no pueden estar en blanco"))); } break; case "register": if ($user->getUID()) { die(json_encode(array("status" => "ERROR", "msg" => "No tienes permitido hacer eso"))); } if (isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["email"]) && isset($_POST["repassword"]) && ($_POST["username"] != "" && $_POST["password"] != "" && $_POST["email"] != "" && $_POST["repassword"] != "")) { if (ctype_alnum($_POST["username"])) { if (filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {