| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_auth/alt_auth_login_class.php,v $ 14 | $Revision: 1.5 $ 15 | $Date: 2007/01/11 18:35:06 $ 16 | $Author: mcfly_e107 $ 17 +----------------------------------------------------------------------------+ 18 */ 19 class alt_login 20 { 21 function alt_login($method, &$username, &$userpass) 22 { 23 global $pref; 24 $newvals=array(); 25 define("AUTH_SUCCESS", -1); 26 define("AUTH_NOUSER", 1); 27 define("AUTH_BADPASSWORD", 2); 28 define("AUTH_NOCONNECT", 3); 29 require_once(e_PLUGIN."alt_auth/".$method."_auth.php"); 30 $_login = new auth_login; 31 32 if($_login->Available === FALSE) 33 { 34 return false; 35 } 36 37 $login_result = $_login -> login($username, $userpass, $newvals); 38 39 if($login_result === AUTH_SUCCESS ) 40 { 41 $sql = new db; 42 if (MAGIC_QUOTES_GPC == FALSE) 43 { 44 $username = mysql_real_escape_string($username); 45 } 46 $username = preg_replace("/\sOR\s|\=|\#/", "", $username); 47 $username = substr($username, 0, 30); 48 49 if(!$sql -> db_Select("user", "user_id", "user_loginname='{$username}' ")) 50 { 51 // User not found in e107 database - add it now. 52 $qry = "INSERT INTO #user (user_id, user_loginname, user_name, user_join) VALUES ('0','{$username}','{$username}',".time().")"; 53 $sql -> db_Select_gen($qry); 54 } 55 // Set password and any other applicable fields 56 $qry="user_password='".md5($userpass)."'"; 57 foreach($newvals as $key => $val) 58 { 59 $qry .= " ,user_{$key}='{$val}' "; 60 } 61 $qry.=" WHERE user_loginname='{$username}' "; 62 $sql->db_Update("user", $qry); 63 } 64 else 65 { 66 switch($login_result) 67 { 68 case AUTH_NOUSER: 69 if(!isset($pref['auth_nouser']) || !$pref['auth_nouser']) 70 { 71 $username=md5("xx_nouser_xx"); 72 } 73 break; 74 case AUTH_NOCONNECT: 75 if(!isset($pref['auth_noconn']) || !$pref['auth_noconn']) 76 { 77 $username=md5("xx_noconn_xx"); 78 } 79 break; 80 case AUTH_BADPASSWORD: 81 $userpass=md5("xx_badpassword_xx"); 82 break; 83 } 84 } 85 } 86 } 87 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |