han_login.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 199 行
PHP
199 行
<?php/*+--------------------------------------------------------------------------| Invision Power Board v2.1.5| =============================================| by Matthew Mecham| (c) 2001 - 2005 Invision Power Services, Inc.| | =============================================| Web: | Time: Wed, 01 Mar 2006 19:11:29 GMT| Release: | Licence Info: +---------------------------------------------------------------------------| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $| > $Revision: 23 $| > $Author: matt $+---------------------------------------------------------------------------|| > Post Handler| > Module written by Matt Mecham| > Date started: Wednesday 9th March 2005 (15:23)|+--------------------------------------------------------------------------*/if ( ! defined( 'IN_IPB' ) ){ print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit();}class han_login{ # Global var $ipsclass; var $module; var $is_admin_auth = 0; var $return_code = 'WRONG_AUTH'; var $member = array( 'id' => 0 ); # Work var $login_method = array(); var $login_conf = array(); /*-------------------------------------------------------------------------*/ // INIT /*-------------------------------------------------------------------------*/ function init() { //----------------------------------------- // INIT //----------------------------------------- $class = ""; $conf = ""; //----------------------------------------- // Load DB info //----------------------------------------- $this->login_method = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) ); //$this->login_method['login_folder_name'] = 'external'; $class = ROOT_PATH.'sources/loginauth/'.$this->login_method['login_folder_name'].'/auth.php'; $conf = ROOT_PATH.'sources/loginauth/'.$this->login_method['login_folder_name'].'/conf.php'; //----------------------------------------- // Got nothing? //----------------------------------------- if ( ! $this->login_method['login_id'] OR ! file_exists( $class ) ) { $this->login_method = array( 'login_title' => 'Internal', 'login_folder_name' => 'internal', 'login_allow_create' => 0 ); $class = ROOT_PATH.'sources/loginauth/internal/auth.php'; $conf = ROOT_PATH.'sources/loginauth/internal/conf.php'; } //----------------------------------------- // Attempt to load class //----------------------------------------- if ( file_exists( $class ) ) { require_once( ROOT_PATH . "sources/loginauth/login_core.php" ); require_once( $class ); $this->module = new login_method(); $this->module->ipsclass =& $this->ipsclass; } else { fatal_error( "CANNOT LOCATE LOG IN FILE FOR {$this->login_method['login_folder_name']}" ); exit(); } //----------------------------------------- // Get conf //----------------------------------------- if ( file_exists( $conf ) ) { require_once( $conf ); $this->login_conf = $LOGIN_CONF; } //----------------------------------------- // Set up //----------------------------------------- $this->module->is_admin_auth = $this->is_admin_auth; $this->module->allow_create = $this->login_method['login_allow_create']; $this->module->login_method = $this->login_method; $this->module->login_conf = $this->login_conf; } /*-------------------------------------------------------------------------*/ // PASSWORD CHECK /*-------------------------------------------------------------------------*/ function login_password_check( $username, $password ) { $this->module->allow_create = 0; if ( $this->login_method['login_folder_name'] != 'internal' AND $this->login_method['login_type'] == 'onfail' ) { # Attempt local-auth first $this->module->auth_local( $username, $password ); # Success? Return... if ( $this->module->return_code == 'SUCCESS' ) { $this->return_code = $this->module->return_code; $this->member = $this->module->member; return; } # No? attempt remote auth else { $this->module->authenticate( $username, $password ); $this->return_code = $this->module->return_code == 'SUCCESS' ? 'SUCCESS' : 'FAIL'; $this->member = $this->module->member; } } else { $this->module->authenticate( $username, $password ); $this->return_code = $this->module->return_code == 'SUCCESS' ? 'SUCCESS' : 'FAIL'; $this->member = $this->module->member; } } /*-------------------------------------------------------------------------*/ // AUTHENTICATE /*-------------------------------------------------------------------------*/ function login_authenticate( $username, $password ) { //----------------------------------------- // On fail? //----------------------------------------- if ( $this->login_method['login_folder_name'] != 'internal' AND $this->login_method['login_type'] == 'onfail' ) { # Attempt local-auth first $this->module->auth_local( $username, $password ); # Success? Return... if ( $this->module->return_code == 'SUCCESS' ) { $this->return_code = $this->module->return_code; $this->member = $this->module->member; return; } # No? attempt remote auth else { $this->module->authenticate( $username, $password ); $this->return_code = $this->module->return_code; $this->member = $this->module->member; } } else { $this->module->authenticate( $username, $password ); $this->return_code = $this->module->return_code; $this->member = $this->module->member; } }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?