]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
Calculate weekly used time correctly (from Sunday 00:00:00)
authorkkalev <kkalev>
Tue, 23 Sep 2003 12:09:43 +0000 (12:09 +0000)
committerkkalev <kkalev>
Tue, 23 Sep 2003 12:09:43 +0000 (12:09 +0000)
Changelog
htdocs/user_admin.php3

index f5f440756fe0ffb54611dc0873f837ad4676c7ba..98dcb70369507a61f10aa61d5ac9d4cd2c1483d0 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -41,6 +41,7 @@ Ver 1.63:
 * Add a few more attribute help pages from Ulrich Walcher <uwalcher@bcore.de>
 * Also check for $server != '' in stats.php3. Bug noted by Ulrich Walcher <uwalcher@bcore.de>
 * Consider the account locked either if Dialup-Access == FALSE or if it is not set at all
+* Calculate weekly used time correctly (from Sunday 00:00:00)
 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 e9a44c1744a1e5de965e70637834553672099b5b..1be9a4263e393fb252d4ceef2e4ce66f44581088 100644 (file)
@@ -93,7 +93,6 @@ if ($link){
        AND AcctStartTime >= '$week_str' AND AcctStartTime <= '$now_str';");
        if ($search){
                $row = @da_sql_fetch_array($search,$config);
-               $weekly_used = $row['sum(AcctSessionTime)'];
                $tot_time = time2str($row['sum(AcctSessionTime)']);
                $tot_input = bytes2str($row['sum(AcctInputOctets)']);
                $tot_output = bytes2str($row['sum(AcctOutputOctets)']);
@@ -105,6 +104,15 @@ if ($link){
        else
                echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
        $search = @da_sql_query($link,$config,
+       "SELECT sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE UserName = '$login'
+       AND AcctStartTime >= '$week_start' AND AcctStartTime <= '$now_str';");
+       if ($search){
+               $row = @da_sql_fetch_array($search,$config);
+               $weekly_used = $row['sum(AcctSessionTime)'];
+       }
+       else
+               echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
+       $search = @da_sql_query($link,$config,
        "SELECT COUNT(*) FROM $config[sql_accounting_table] WHERE UserName = '$login'
        AND AcctStopTime >= '$week_str' AND AcctStopTime <= '$now_str'
        AND (AcctTerminateCause LIKE 'Login-Incorrect%' OR