public function index() { try_login(); $uid = (int) session('uid'); $db = D('Favorites'); $cnts = $db->cnt($uid); $this->assign('counts', $cnts); $this->assign('title', '我的收藏'); $this->display(); }
<?php set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include_once "aur.inc.php"; set_lang(); check_sid(); $disable_http_login = config_get_bool('options', 'disable_http_login'); if (!$disable_http_login || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) { $login = try_login(); $login_error = $login['error']; } html_header('AUR ' . __("Login")); ?> <div id="dev-login" class="box"> <h2>AUR <?php echo __('Login'); ?> </h2> <?php if (isset($_COOKIE["AURSID"])) { ?> <p> <?php echo __("Logged-in as: %s", '<strong>' . username_from_sid($_COOKIE["AURSID"]) . '</strong>'); ?> <a href="<?php echo get_uri('/logout/'); ?> ">[<?php echo __("Logout"); ?>
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* Template Name: Ajax page */ //var_dump($_POST); if (isset($_POST["action"])) { switch ($_POST["action"]) { case "0": //Login if (isset($_POST["user"]) && isset($_POST["pass"])) { include_once 'function/logic.php'; $result = try_login($_POST["user"], $_POST["pass"]); if ($result) { echo json_encode(array('r' => 1, 'd' => $result)); } else { echo json_encode(array('r' => 0, 'd' => "Usuario o contraseña incorrectos.")); } } break; case "1": ////Change pass if (isset($_POST["old"]) && isset($_POST["new"])) { include_once 'function/logic.php'; $result = user_changepassword($_POST['old'], $_POST['new']); if ($result[0]) { echo json_encode(array('r' => 1, 'd' => $result[1])); } else {
<?php include_once 'includes/config.inc.php'; include_once 'includes/session.inc.php'; include_once 'includes/misc.inc.php'; global $errormsg, $blocklogin; if (isset($_GET['logout']) or isset($_POST['logout'])) { logout(); header("Location: index.php"); exit(0); } if (!is_logged_in() and isset($_POST['formname']) and $_POST['formname'] === "loginform") { if (!try_login()) { $errormsg = "Error while trying to authenticate you\n"; } } ?> <!DOCTYPE html> <html> <head> <title>NSEdit!</title> <link href="jquery-ui/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"/> <link href="jtable/lib/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css"/> <link href="css/base.css" rel="stylesheet" type="text/css"/> <?php if ($menutype === 'horizontal') { ?> <link href="css/horizontal-menu.css" rel="stylesheet" type="text/css"/> <?php } ?>
function openid_auth_do() { if (!is_login()) { $userEmail = OpenId::getUserEmail(); $userName = $userEmail['userName']; $email = $userEmail['email']; $genPassword = hash('md5', 'XFAGAGArere' . $email); if (!is_email_accepted($email)) { die('该邮箱不能登录本系统!'); } $result = try_login($email, $genPassword); if ($result == 'succeed') { //如果用户已经被注册过,直接登录 forward('?c=dashboard'); } elseif ($result == 'failed') { //否则,先注册用户再登录 register($email, $userName, $genPassword); try_login($email, $genPassword); forward('?c=dashboard'); } die('帐号已经被管理员关闭,请联系管理员'); } }
*/ include "lib/LibMooege.php"; $email = ''; $password = ''; // See if request contains email & password. if (array_key_exists('email', $_REQUEST)) { $email = $_REQUEST['email']; } if (array_key_exists('password', $_REQUEST)) { $password = $_REQUEST['password']; } if (empty($email) || empty($password)) { // if email or password is empty. print_login_form(); } else { try_login($email, $password); } // try loging using given credentals. function try_login($email, $password) { $mooege = new LibMooege("http://localhost", 9000); // change this line to match your configuration. if (!$mooege->connected) { // check if we have a succesfull connection there. die("Can not connect to mooege!"); } $verified = $mooege->VerifyPassword($email, $password); if ($verified) { echo "Login succesful!"; } else { echo "Login failed!";
header("Cache-Control: no-store, no-cache, must-revalidate"); setcookie('itv_auth', 'false', time() - 120 * 60, '/', '.itv.by'); setcookie('itv_login', '', time() - 36000, '/', '.itv.by'); setcookie('itv_password', '', time() - 36000, '/', '.itv.by'); setcookie('itv_mac', '', time() - 36000, '/', '.itv.by'); setcookie('itv_first_name', '', time() - 36000, '/', '.itv.by'); setcookie('itv_last_name', '', time() - 36000, '/', '.itv.by'); header("Location: http://ikino.itv.by/"); } require_once "options.php"; require_once "login.php"; /*авторизация после отравки запроса, или из куки*/ if ($_POST['go-login'] == ' ') { $usrLogin = $_POST['signin']['username']; $usrPass = $_POST['signin']['password']; $login_result = try_login($usrLogin, $usrPass); if ($login_result->STATUS === 0) { $_SESSION['is_autorised'] = true; $_SESSION['autorised_login'] = $usrLogin; $_SESSION['autorised_pass'] = $usrPass; $_SESSION['autorised_first_name'] = $login_result->FIRST_NAME; $_SESSION['autorised_last_name'] = $login_result->LAST_NAME; $_SESSION['autorised_mac'] = $login_result->MAC; //сохранение данных в куке для авторизации setcookie('itv_auth', 'true', time() + 36000, '/', '.itv.by'); setcookie('itv_login', $_SESSION['autorised_login'], time() + 36000, '/', '.itv.by'); setcookie('itv_password', $_SESSION['autorised_pass'], time() + 36000, '/', '.itv.by'); setcookie('itv_mac', $_SESSION['autorised_mac'], time() + 36000, '/', '.itv.by'); setcookie('itv_first_name', $_SESSION['autorised_first_name'], time() + 36000, '/', '.itv.by'); setcookie('itv_last_name', $_SESSION['autorised_last_name'], time() + 36000, '/', '.itv.by'); } else {
echo "test old hash method"; echo "shopex standard hash is : "; echo $obj_user->passwd; echo "\n"; echo "test old method bad\n"; $passwd = 'comax'; $v = try_login($username, $passwd); var_dump($v); echo "test old method ok\n"; $passwd = 'shopex'; $v = try_login($username, $passwd); var_dump($v); echo "\n"; echo "\n--------------------------\n"; #test our md5 hash echo "test new hash method"; echo "shopex new hash is : "; echo $obj_user->passwd; echo "\n"; echo "test new method bad\n"; $passwd = 'comax'; $v = try_login($username, $passwd); var_dump($v); echo "test new method ok\n"; $passwd = 'shopex'; $v = try_login($username, $passwd); var_dump($v); echo "\n"; echo "\n--------------------------\n"; echo "all test done!"; #测试方法:在命令行先执行: php md5.php