* html fixes in accounting.php3
* Fix a problem in user_accounting when NASIPAddress is not set.
* Use CISCO-AAA-SESSION-MIB in snmpfinger
+* In lib/ldap/functions.php3 only ask for the cn attribute in ldap_search not the whole entry. That should make
+ user_finger a lot faster when the user database is in ldap
+* In lib/functions.php3 pass a second argument to date2timediv with the current time. user_finger calls that
+ function for each online user so we now don't need to do a lot of calls to time() but only one. That should make
+ user_finger somewhat faster.
Ver 1.59:
* Small html fixes in user_edit.php3 and password.php3
* Show number of failed logins in the last 7 days in the user admin page
$lastlog_time = $row['AcctStartTime'];
$lastlog_server_ip = $row['NASIPAddress'];
$lastlog_server_port = $row['NASPortId'];
- $lastlog_session_time = date2timediv($lastlog_time);
+ $lastlog_session_time = date2timediv($lastlog_time,0);
if ($daily_limit != 'none'){
$remaining = $remaining - $lastlog_session_time;
if ($remaining < 0)
AcctStopTime = '0' AND NASIPAddress = '$name_data' $extra
GROUP BY UserName ORDER BY AcctStartTime;");
if ($search){
+ $now = time();
while($row = @da_sql_fetch_array($search,$config)){
$num++;
$h += 21;
if ($finger_info[$servers_num][$num]['ip'] == '')
$finger_info[$servers_num][$num]['ip'] = '-';
$session_time = $row['AcctStartTime'];
- $session_time = date2timediv($session_time);
+ $session_time = date2timediv($session_time,$now);
$finger_info[$servers_num][$num]['session_time'] = time2strclock($session_time);
$finger_info[$servers_num][$num]['user'] = $user;
$finger_info[$servers_num][$num]['callerid'] = $row['CallingStationId'];
return $ret;
}
-function date2timediv($date)
+function date2timediv($date,$now)
{
list($day,$time)=explode(' ',$date);
$day = explode('-',$day);
$time = explode(':',$time);
$timest = mktime($time[0],$time[1],$time[2],$day[1],$day[2],$day[0]);
- $now = time();
+ if (!$now)
+ $now = time();
return ($now - $timest);
}
function get_user_info($ds,$user,$config)
{
if ($ds){
- $sr=@ldap_search($ds,"$config[ldap_base]", "uid=" . $user);
+ $attrs = array('cn');
+ $sr=@ldap_search($ds,"$config[ldap_base]", "uid=" . $user,$attrs);
$info = @ldap_get_entries($ds, $sr);
$cn = $info[0]["cn"][0];
if ($cn == '')