From 1e71898e8be1690a64a8789037b966e1404daedc Mon Sep 17 00:00:00 2001 From: kkalev Date: Sat, 28 Dec 2002 11:33:20 +0000 Subject: [PATCH] Add more error messages when interacting with the SQL database --- Changelog | 1 + htdocs/accounting.php3 | 2 ++ htdocs/badusers.php3 | 4 ++++ htdocs/failed_logins.php3 | 4 ++++ htdocs/show_groups.php3 | 2 +- htdocs/stats.php3 | 4 ++++ htdocs/user_accounting.php3 | 4 ++++ htdocs/user_admin.php3 | 12 ++++++++++++ htdocs/user_finger.php3 | 2 ++ lib/sql/change_attrs.php3 | 2 +- lib/sql/change_info.php3 | 2 +- lib/sql/change_passwd.php3 | 2 +- lib/sql/create_group.php3 | 2 +- lib/sql/create_user.php3 | 2 +- lib/sql/defaults.php3 | 2 +- lib/sql/delete_group.php3 | 2 +- lib/sql/delete_user.php3 | 2 +- lib/sql/find.php3 | 2 +- lib/sql/group_admin.php3 | 2 +- lib/sql/group_info.php3 | 2 +- lib/sql/user_info.php3 | 2 +- 21 files changed, 46 insertions(+), 13 deletions(-) diff --git a/Changelog b/Changelog index 4a6ccf7..4969a6c 100644 --- a/Changelog +++ b/Changelog @@ -19,6 +19,7 @@ Ver 1.62: * Add sql_use_http_credentials configuration directive to connect to the sql database using the http user credentials (that way there can be more than one administrator usernames, each with different privileges on the sql database). +* Add more error messages when interacting with the SQL database Ver 1.61: * Add a string encoder for greek * If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future diff --git a/htdocs/accounting.php3 b/htdocs/accounting.php3 index 53e9c68..4fc5709 100644 --- a/htdocs/accounting.php3 +++ b/htdocs/accounting.php3 @@ -260,6 +260,8 @@ EOM; echo "\n"; } } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; echo << diff --git a/htdocs/badusers.php3 b/htdocs/badusers.php3 index f05d4ca..be7e5be 100644 --- a/htdocs/badusers.php3 +++ b/htdocs/badusers.php3 @@ -107,7 +107,11 @@ if ($link){ EOM; } } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } +else + echo "Could not connect to SQL database
\n"; echo << diff --git a/htdocs/failed_logins.php3 b/htdocs/failed_logins.php3 index 15a166b..7f8736e 100644 --- a/htdocs/failed_logins.php3 +++ b/htdocs/failed_logins.php3 @@ -134,7 +134,11 @@ if ($link){ EOM; } } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } +else + echo "Could not connect to SQL database
\n"; echo << diff --git a/htdocs/show_groups.php3 b/htdocs/show_groups.php3 index 02edd96..4e26942 100644 --- a/htdocs/show_groups.php3 +++ b/htdocs/show_groups.php3 @@ -76,7 +76,7 @@ EOM; echo "Could not find any groups
\n"; } else - echo "Search failed. SQL Error: " . da_sql_error($link,$config) . "
\n"; + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } else echo "Could not connect to SQL database
\n"; diff --git a/htdocs/stats.php3 b/htdocs/stats.php3 index 709d6fa..5dd6d04 100644 --- a/htdocs/stats.php3 +++ b/htdocs/stats.php3 @@ -103,8 +103,12 @@ if ($link){ $data[sum][3] += $row["$res[3]"]; $num[3] = ($data[$day][3]) ? $num[3] + 1 : $num[3]; } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } } +else + echo "Could not connect to SQL database
\n"; $num[1] = ($num[1]) ? $num[1] : 1; $num[2] = ($num[2]) ? $num[2] : 1; diff --git a/htdocs/user_accounting.php3 b/htdocs/user_accounting.php3 index 86547f3..57c6689 100644 --- a/htdocs/user_accounting.php3 +++ b/htdocs/user_accounting.php3 @@ -147,7 +147,11 @@ EOM; $acct_upload_sum = bytes2str($acct_upload_sum); $acct_download_sum = bytes2str($acct_download_sum); } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } +else + echo "Could not connect to SQL database
\n"; echo << Page Total diff --git a/htdocs/user_admin.php3 b/htdocs/user_admin.php3 index dfd147d..be0d475 100644 --- a/htdocs/user_admin.php3 +++ b/htdocs/user_admin.php3 @@ -100,6 +100,8 @@ if ($link){ $avg_output = bytes2str($row['avg(AcctOutputOctets)']); $tot_conns = $row['COUNT(*)']; } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\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' @@ -110,6 +112,8 @@ if ($link){ $row = @da_sql_fetch_array($search,$config); $tot_badlogins = $row['COUNT(*)']; } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; for($i = 0; $i <=6; $i++){ if ($days[$i] == '') continue; @@ -139,6 +143,8 @@ if ($link){ $daily_used = "$daily_used"; } } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } if ($weekly_limit != 'none'){ $tmp = $weekly_limit - $weekly_used; @@ -192,6 +198,8 @@ if ($link){ $lastlog_output = 'not available'; } } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; if (! $logged_now){ $search = @da_sql_query($link,$config, "SELECT * FROM $config[sql_accounting_table] @@ -218,8 +226,12 @@ if ($link){ else $not_known = 1; } + else + echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } } +else + echo "Could not connect to SQL database
\n"; $monthly_limit = (is_numeric($monthly_limit)) ? time2str($monthly_limit) : $monthly_limit; $weekly_limit = (is_numeric($weekly_limit)) ? time2str($weekly_limit) : $weekly_limit; diff --git a/htdocs/user_finger.php3 b/htdocs/user_finger.php3 index fbcf78a..570885b 100644 --- a/htdocs/user_finger.php3 +++ b/htdocs/user_finger.php3 @@ -109,6 +109,8 @@ if ($link){ $server_rem[$servers_num] = ($config[$portnum]) ? ($config[$portnum] - $num) : 'unknown'; } } +else + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/change_attrs.php3 b/lib/sql/change_attrs.php3 index 6ec9d19..3f9ea6f 100644 --- a/lib/sql/change_attrs.php3 +++ b/lib/sql/change_attrs.php3 @@ -95,4 +95,4 @@ if ($link){ } } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; diff --git a/lib/sql/change_info.php3 b/lib/sql/change_info.php3 index b00ca6f..b50c0a6 100644 --- a/lib/sql/change_info.php3 +++ b/lib/sql/change_info.php3 @@ -46,5 +46,5 @@ if ($link){ } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/change_passwd.php3 b/lib/sql/change_passwd.php3 index c0be03a..26dae6d 100644 --- a/lib/sql/change_passwd.php3 +++ b/lib/sql/change_passwd.php3 @@ -47,5 +47,5 @@ if ($link){ echo "Could not open encryption library file
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/create_group.php3 b/lib/sql/create_group.php3 index 7c7bac0..335d8ef 100644 --- a/lib/sql/create_group.php3 +++ b/lib/sql/create_group.php3 @@ -65,5 +65,5 @@ if ($link){ echo "Group created successfully
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/create_user.php3 b/lib/sql/create_user.php3 index 8e16d13..1ec8ca9 100644 --- a/lib/sql/create_user.php3 +++ b/lib/sql/create_user.php3 @@ -105,5 +105,5 @@ if ($link){ echo "Could not open encryption library file
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/defaults.php3 b/lib/sql/defaults.php3 index 9b1f5f9..bd2a701 100644 --- a/lib/sql/defaults.php3 +++ b/lib/sql/defaults.php3 @@ -107,7 +107,7 @@ if ($login != ''){ } } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; }while($stop == 0); } ?> diff --git a/lib/sql/delete_group.php3 b/lib/sql/delete_group.php3 index cad79b6..b400586 100644 --- a/lib/sql/delete_group.php3 +++ b/lib/sql/delete_group.php3 @@ -27,5 +27,5 @@ if ($link){ echo "Error deleting group $login from group reply table: " . da_sql_error($link,$config) . "
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/delete_user.php3 b/lib/sql/delete_user.php3 index b7431a6..97109de 100644 --- a/lib/sql/delete_user.php3 +++ b/lib/sql/delete_user.php3 @@ -33,5 +33,5 @@ if ($link){ echo "Error deleting user $login from reply table: " . da_sql_error($link,$config) . "
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/find.php3 b/lib/sql/find.php3 index 2c63819..d4291f1 100644 --- a/lib/sql/find.php3 +++ b/lib/sql/find.php3 @@ -39,5 +39,5 @@ if ($link){ } } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/group_admin.php3 b/lib/sql/group_admin.php3 index 94b78cc..012b4e0 100644 --- a/lib/sql/group_admin.php3 +++ b/lib/sql/group_admin.php3 @@ -40,5 +40,5 @@ if ($link){ } } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/group_info.php3 b/lib/sql/group_info.php3 index eb29d74..d9cd060 100644 --- a/lib/sql/group_info.php3 +++ b/lib/sql/group_info.php3 @@ -87,5 +87,5 @@ if ($link){ echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> diff --git a/lib/sql/user_info.php3 b/lib/sql/user_info.php3 index 81abcfb..415ad33 100644 --- a/lib/sql/user_info.php3 +++ b/lib/sql/user_info.php3 @@ -116,5 +116,5 @@ if ($link){ echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; } else - echo "Could not connect to database
\n"; + echo "Could not connect to SQL database
\n"; ?> -- 2.39.5