[ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: checklogin.php 1023 2007-09-08 02:55:26Z phppp $ 3 // ------------------------------------------------------------------------ // 4 // XOOPS - PHP Content Management System // 5 // Copyright (c) 2000 XOOPS.org // 6 // <http://www.xoops.org/> // 7 // ------------------------------------------------------------------------ // 8 // This program is free software; you can redistribute it and/or modify // 9 // it under the terms of the GNU General Public License as published by // 10 // the Free Software Foundation; either version 2 of the License, or // 11 // (at your option) any later version. // 12 // // 13 // You may not change or alter any portion of this comment or credits // 14 // of supporting developers from this source code or any supporting // 15 // source code which is considered copyrighted (c) material of the // 16 // original comment or credit authors. // 17 // // 18 // This program is distributed in the hope that it will be useful, // 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 21 // GNU General Public License for more details. // 22 // // 23 // You should have received a copy of the GNU General Public License // 24 // along with this program; if not, write to the Free Software // 25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 26 // ------------------------------------------------------------------------ // 27 // Author: Kazumi Ono (AKA onokazu) // 28 // URL: http://www.xoops.org/ http://jp.xoops.org/ http://www.myweb.ne.jp/ // 29 // Project: The XOOPS Project (http://www.xoops.org/) // 30 // ------------------------------------------------------------------------- // 31 32 if (!defined('XOOPS_ROOT_PATH')) { 33 exit(); 34 } 35 include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php'; 36 $uname = !isset($_POST['uname']) ? '' : trim($_POST['uname']); 37 $pass = !isset($_POST['pass']) ? '' : trim($_POST['pass']); 38 if ($uname == '' || $pass == '') { 39 redirect_header(XOOPS_URL.'/user.php', 1, _US_INCORRECTLOGIN); 40 exit(); 41 } 42 $member_handler =& xoops_gethandler('member'); 43 $myts =& MyTextsanitizer::getInstance(); 44 45 include_once XOOPS_ROOT_PATH.'/class/auth/authfactory.php'; 46 include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/auth.php'; 47 $xoopsAuth =& XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname)); 48 $user = $xoopsAuth->authenticate($myts->addSlashes($uname), $myts->addSlashes($pass)); 49 50 if (false != $user) { 51 if (0 == $user->getVar('level')) { 52 redirect_header(XOOPS_URL.'/index.php', 5, _US_NOACTTPADM); 53 exit(); 54 } 55 if ($xoopsConfig['closesite'] == 1) { 56 $allowed = false; 57 foreach ($user->getGroups() as $group) { 58 if (in_array($group, $xoopsConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) { 59 $allowed = true; 60 break; 61 } 62 } 63 if (!$allowed) { 64 redirect_header(XOOPS_URL.'/index.php', 1, _NOPERM); 65 exit(); 66 } 67 } 68 $user->setVar('last_login', time()); 69 if (!$member_handler->insertUser($user)) { 70 } 71 // Regenrate a new session id and destroy old session 72 $GLOBALS["sess_handler"]->regenerate_id(true); 73 $_SESSION = array(); 74 $_SESSION['xoopsUserId'] = $user->getVar('uid'); 75 $_SESSION['xoopsUserGroups'] = $user->getGroups(); 76 $user_theme = $user->getVar('theme'); 77 if (in_array($user_theme, $xoopsConfig['theme_set_allowed'])) { 78 $_SESSION['xoopsUserTheme'] = $user_theme; 79 } 80 if (!empty($_POST['xoops_redirect']) && !strpos($_POST['xoops_redirect'], 'register')) { 81 $_POST['xoops_redirect'] = trim( $_POST['xoops_redirect'] ); 82 $parsed = parse_url(XOOPS_URL); 83 $url = isset($parsed['scheme']) ? $parsed['scheme'].'://' : 'http://'; 84 if ( isset( $parsed['host'] ) ) { 85 $url .= $parsed['host']; 86 if ( isset( $parsed['port'] ) ) { 87 $url .= ':' . $parsed['port']; 88 } 89 } else { 90 $url .= $_SERVER['HTTP_HOST']; 91 } 92 if ( @$parsed['path'] ) { 93 if ( strncmp( $parsed['path'], $_POST['xoops_redirect'], strlen( $parsed['path'] ) ) ) { 94 $url .= $parsed['path']; 95 } 96 } 97 $url .= $_POST['xoops_redirect']; 98 } else { 99 $url = XOOPS_URL.'/index.php'; 100 } 101 102 // RMV-NOTIFY 103 // Perform some maintenance of notification records 104 $notification_handler =& xoops_gethandler('notification'); 105 $notification_handler->doLoginMaintenance($user->getVar('uid')); 106 107 redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')), false); 108 }elseif(empty($_POST['xoops_redirect'])){ 109 redirect_header(XOOPS_URL.'/user.php', 5, $xoopsAuth->getHtmlErrors()); 110 }else{ 111 redirect_header(XOOPS_URL.'/user.php?xoops_redirect='.urlencode(trim($_POST['xoops_redirect'])), 5, $xoopsAuth->getHtmlErrors(), false); 112 } 113 exit(); 114 115 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |