[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Authenticate.php,v 1.10 2005/02/28 05:25:22 jack Exp $ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 require_once ('modules/Users/Users.php'); 24 require_once ('modules/Users/CreateUserPrivilegeFile.php'); 25 require_once ('include/logging.php'); 26 require_once ('user_privileges/audit_trail.php'); 27 28 global $mod_strings; 29 30 $focus = new Users(); 31 32 // Add in defensive code here. 33 $focus->column_fields["user_name"] = to_html($_REQUEST['user_name']); 34 $user_password = $_REQUEST['user_password']; 35 36 $focus->load_user($user_password); 37 38 if($focus->is_authenticated()) 39 { 40 41 //Inserting entries for audit trail during login 42 43 if($audit_trail == 'true') 44 { 45 if($record == '') 46 $auditrecord = ''; 47 else 48 $auditrecord = $record; 49 50 $date_var = $adb->formatDate(date('YmdHis')); 51 $query = "insert into vtiger_audit_trial values(".$adb->getUniqueID('vtiger_audit_trial').",".$focus->id.",'Users','Authenticate','',$date_var)"; 52 53 $adb->query($query); 54 } 55 56 57 // Recording the login info 58 $usip=$_SERVER['REMOTE_ADDR']; 59 $intime=date("Y/m/d H:i:s"); 60 require_once ('modules/Users/LoginHistory.php'); 61 $loghistory=new LoginHistory(); 62 $Signin = $loghistory->user_login($focus->column_fields["user_name"],$usip,$intime); 63 64 //Security related entries start 65 require_once ('include/utils/UserInfoUtil.php'); 66 67 createUserPrivilegesfile($focus->id); 68 69 //Security related entries end 70 header("Location: index.php?action=index&module=Home"); 71 session_unregister('login_password'); 72 session_unregister('login_error'); 73 session_unregister('login_user_name'); 74 75 $_SESSION['authenticated_user_id'] = $focus->id; 76 $_SESSION['app_unique_key'] = $application_unique_key; 77 78 // store the user's theme in the session 79 if (isset($_REQUEST['login_theme'])) { 80 $authenticated_user_theme = $_REQUEST['login_theme']; 81 } 82 elseif (isset($_REQUEST['ck_login_theme'])) { 83 $authenticated_user_theme = $_REQUEST['ck_login_theme']; 84 } 85 else { 86 $authenticated_user_theme = $default_theme; 87 } 88 89 // store the user's language in the session 90 if (isset($_REQUEST['login_language'])) { 91 $authenticated_user_language = $_REQUEST['login_language']; 92 } 93 elseif (isset($_REQUEST['ck_login_language'])) { 94 $authenticated_user_language = $_REQUEST['ck_login_language']; 95 } 96 else { 97 $authenticated_user_language = $default_language; 98 } 99 100 // If this is the default user and the default user theme is set to reset, reset it to the default theme value on each login 101 if($reset_theme_on_default_user && $focus->user_name == $default_user_name) 102 { 103 $authenticated_user_theme = $default_theme; 104 } 105 if(isset($reset_language_on_default_user) && $reset_language_on_default_user && $focus->user_name == $default_user_name) 106 { 107 $authenticated_user_language = $default_language; 108 } 109 110 $_SESSION['authenticated_user_theme'] = $authenticated_user_theme; 111 $_SESSION['authenticated_user_language'] = $authenticated_user_language; 112 113 $log->debug("authenticated_user_theme is $authenticated_user_theme"); 114 $log->debug("authenticated_user_language is $authenticated_user_language"); 115 $log->debug("authenticated_user_id is ". $focus->id); 116 $log->debug("app_unique_key is $application_unique_key"); 117 118 119 // Clear all uploaded import files for this user if it exists 120 121 global $import_dir; 122 123 $tmp_file_name = $import_dir. "IMPORT_".$focus->id; 124 125 if (file_exists($tmp_file_name)) 126 { 127 unlink($tmp_file_name); 128 } 129 } 130 else 131 { 132 $_SESSION['login_user_name'] = $focus->column_fields["user_name"]; 133 $_SESSION['login_password'] = $user_password; 134 $_SESSION['login_error'] = $mod_strings['ERR_INVALID_PASSWORD']; 135 136 // go back to the login screen. 137 // create an error message for the user. 138 header("Location: index.php"); 139 } 140 141 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |