Changeset 3513 in subversion for trunk/roundcubemail/program/include/main.inc
- Timestamp:
- Apr 20, 2010 12:04:33 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/include/main.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r3510 r3513 1142 1142 1143 1143 /** 1144 * Write login data (name, ID, IP address) to the 'userlogins' log file. 1145 */ 1146 function rcmail_log_login() 1147 { 1148 global $RCMAIL; 1149 1150 if (!$RCMAIL->config->get('log_logins') || !$RCMAIL->user) 1151 return; 1152 1153 $address = $_SERVER['REMOTE_ADDR']; 1154 // append the NGINX X-Real-IP header, if set 1155 if (!empty($_SERVER['HTTP_X_REAL_IP'])) { 1156 $remote_ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP']; 1157 } 1158 // append the X-Forwarded-For header, if set 1159 if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { 1160 $remote_ip[] = 'X-Forwarded-For: ' . $_SERVER['HTTP_X_FORWARDED_FOR']; 1161 } 1162 1163 if (!empty($remote_ip)) 1164 $address .= '(' . implode(',', $remote_ip) . ')'; 1165 1166 write_log('userlogins', sprintf('Successful login for %s (ID: %d) from %s', 1167 $RCMAIL->user->get_username(), $RCMAIL->user->ID, $address)); 1168 } 1169 1170 1171 /** 1144 1172 * @access private 1145 1173 */
Note: See TracChangeset
for help on using the changeset viewer.
