Add a usage_summary parameter in user_finger. If it is passed then we only output...
authorkkalev <kkalev>
Sat, 10 May 2003 13:49:46 +0000 (13:49 +0000)
committerkkalev <kkalev>
Sat, 10 May 2003 13:49:46 +0000 (13:49 +0000)
"Online: <num> Free: <num>" which can be used in outside pages

dialup_admin/Changelog
dialup_admin/README
dialup_admin/htdocs/user_finger.php3

index 59a81c4..fedc09d 100644 (file)
@@ -23,6 +23,8 @@ Ver 1.63:
 * Create a AcctUniqueId before adding a row in radacct in log_badlogins.
 * Use Max-Monthly-Session not Max-Weekly-Session for the monthly limit
 * When checking the weekly limit check first that $remaining is numeric before doing any comparisons
+* Add a usage_summary parameter in user_finger. If it is passed then we only output a text like:
+  "Online: <num> Free: <num>" which can be used in outside pages
 Ver 1.62:
 * Remove one sql query from user_admin which was not needed.
 * Instead of a query like "LIKE 'YYYY-MM-DD%'" use "AcctStopTime >= 'YYYY-MM-DD 00:00:00 AND AcctStopTime
index 0879efd..cc04c8e 100644 (file)
@@ -82,6 +82,8 @@ htdocs:: user_state.php3 =>
 htdocs:: user_finger.php3 =>
        It will finger the nas(es) and show the logged in users. If an argument server is passed then
        it will only show users for the specific access server.
+       If an argument usage_summary is passed then it will only show a line like:
+       "Online: <num> Free: <num>" which can be used by other pages
 
 html:: Contains the html code for a few pages 
 html::user_admin.html.php3 =>
index 99d83d7..3663387 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 require('../conf/config.php3');
-?>
+if (!isset($usage_summary)){
+       echo <<<EOM
 <html>
 <head>
 <META HTTP-EQUIV="Refresh" CONTENT="50">
@@ -8,8 +9,9 @@ require('../conf/config.php3');
 <title>User Finger Facility</title>
 <link rel="stylesheet" href="style.css">
 </head>
+EOM;
+}
 
-<?php
 if ($config[general_decode_normal_attributes] == 'yes'){
        if (is_file("../lib/lang/$config[general_prefered_lang]/utf8.php3"))
                include_once("../lib/lang/$config[general_prefered_lang]/utf8.php3");
@@ -38,6 +40,7 @@ $date = strftime('%A, %e %B %Y, %T %Z');
 
 $link = @da_sql_pconnect($config);
 $link2 = connect2db($config);
+$tot_in = $tot_rem = 0;
 if ($link){
        $h = 21;
        $servers_num = 0;
@@ -107,10 +110,17 @@ if ($link){
                }
                $server_loggedin[$servers_num] = $num;
                $server_rem[$servers_num] = ($config[$portnum]) ? ($config[$portnum] - $num) : 'unknown';
+               $tot_in += $num;
+               if (is_numeric($server_rem[$servers_num]))
+                       $tot_rem += $server_rem[$servers_num];
        }
 }
 else
        echo "<b>Could not connect to SQL database</b><br>\n";
+if (isset($usage_summary)){
+       echo "Online: $tot_in Free: $tot_rem\n";
+       exit();
+}
 ?>
 
 <body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">