From cbf055818ae79b66221c08ba29b6fd2cb18f9fc6 Mon Sep 17 00:00:00 2001 From: kkalev Date: Thu, 7 Feb 2002 09:18:32 +0000 Subject: [PATCH] Add ordering in user_accounting.php3. The results can be either ordered ascending (older first) or descending (recent first). Added a corresponding configuration directive. --- conf/admin.conf | 4 ++++ htdocs/user_accounting.php3 | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/conf/admin.conf b/conf/admin.conf index 472829a..0d3d9f4 100644 --- a/conf/admin.conf +++ b/conf/admin.conf @@ -46,6 +46,10 @@ general_auth_request_file: %{general_base_dir}/conf/auth.request # can be one of crypt,md5,clear # general_encryption_method: crypt +# +# can be either asc (older dates first) or desc (recent dates first) +# +general_accounting_info_order: desc nas1_name: nas1.%{general_domain} nas1_model: Cisco 2511 access server diff --git a/htdocs/user_accounting.php3 b/htdocs/user_accounting.php3 index e6048f3..4751ef0 100644 --- a/htdocs/user_accounting.php3 +++ b/htdocs/user_accounting.php3 @@ -26,6 +26,11 @@ $num = 0; $pagesize = ($pagesize) ? $pagesize : 10; $limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize"; $selected[$pagesize] = 'selected'; +$order = ($order) ? $order : $config[general_accounting_info_order]; +if ($order != 'desc' && $order != 'asc') + $order = 'desc'; +$selected[$order] = 'selected'; + echo << @@ -77,7 +82,7 @@ if ($link){ $search = @da_sql_query($link,$config, "SELECT * FROM $config[sql_accounting_table] WHERE UserName = '$login' AND AcctStartTime <= '$now_str' - AND AcctStartTime >= '$prev_str' ORDER BY AcctStartTime ASC $limit;"); + AND AcctStartTime >= '$prev_str' ORDER BY AcctStartTime $order $limit;"); if ($search){ while( $row = @da_sql_fetch_array($search,$config) ){ $tr_color='white'; @@ -148,7 +153,7 @@ echo <<
- + - + @@ -173,6 +177,11 @@ echo <<all + EOM; ?> -- 2.39.5
the from date matches any login after the 00:00 that day, @@ -157,8 +162,7 @@ echo <<
userfrom dateto datepagesizeuserfrom dateto datepagesizeorder
+