]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
When reporting sql errors also print the output of da_sql_error
authorkkalev <kkalev>
Tue, 13 Aug 2002 15:42:45 +0000 (15:42 +0000)
committerkkalev <kkalev>
Tue, 13 Aug 2002 15:42:45 +0000 (15:42 +0000)
Changelog
htdocs/show_groups.php3
lib/add_badusers.php3
lib/sql/change_info.php3
lib/sql/change_passwd.php3
lib/sql/create_group.php3
lib/sql/create_user.php3
lib/sql/delete_group.php3
lib/sql/delete_user.php3
lib/sql/group_admin.php3

index 96dc9175d17b7e5683bcf19bf0378aeeea995c6e..fd5aeda28a4e7ddceaba57698b9a3dd70c8c7d74 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,6 @@
 Ver 1.53:
 * html fixes in show_groups.php3
+* When reporting sql errors also print the output of da_sql_error
 Ver 1.52:
 * Add Reply-Message in conf/user_edit.attrs so that it appears in the user/group edit pages
 * Allow the administrator to specify a group in the New User page. Update lib/sql/create_user.php3 to add
index 54ea5240fd76501f2685a4299ebbd431bb7c73ab..e9b766106787baef124d1d8e28132eb3bd5a935b 100644 (file)
@@ -74,8 +74,10 @@ EOM;
                        echo "<b>Could not find any groups</b><br>\n";
        }
        else
-               echo "<b>Search failed. SQL Error</b><br>\n";
+               echo "<b>Search failed. SQL Error: " . da_sql_error($link,$config) . "</b><br>\n";
 }
+else
+       echo "<b>Could not connect to SQL database</b><br>\n";
 ?>
        </table>
 </table>
index 22357723f24cca87afa38d2702df01f8da1c97fa..9ee31a66521143d7b0ad71f115e7020e87bd386a 100644 (file)
@@ -21,6 +21,6 @@ else{
                        echo "<b>SQL Error:" . da_sql_error($link) . "</b><br>\n";
        }
        else
-               echo "<b>SQL Error: Could not connect to sql server(" . da_sql_error($link) . ")</b><br>\n";
+               echo "<b>SQL Error: Could not connect to SQL database</b><br>\n";
 }
 ?>
index ddf05dd84c22cd0a4697409d9d7fbc737eb3f48c..4f913e7ff0cbdc50e31c5f09ac01d5288fa0d258 100644 (file)
@@ -19,7 +19,7 @@ if ($link){
                                (UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES
                                ('$login','$Fcn','$Fmail','$Fou','$Ftelephonenumber','$Fhomephone','$Fmobile');");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config)){
-                                       echo "<b>Could not add user information in user info table</b><br>\n";
+                                       echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
                                        $fail = 1;
                                }
                        }
@@ -29,13 +29,13 @@ if ($link){
                                Department = '$Fou', HomePhone = '$Fhomephone', WorkPhone = '$Ftelephonenumber',
                                Mobile = '$Fmobile';");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config)){
-                                       echo "<b>Could not update user information in user info table</b><br>\n";
+                                       echo "<b>Could not update user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
                                        $fail = 1;
                                }
                        }
                }
                else{
-                       echo "<b>Could not find user in user info table. SQL Error</b><br>\n";
+                       echo "<b>Could not find user in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
                        $fail = 1;
                }
                if ($fail == 0)
index dbe908077bc066dc8a92c89663cae86ca535bb5a..7b43c0d4e4d01737ed90c8e32ce58fb64fad0cc8 100644 (file)
@@ -25,18 +25,18 @@ if ($link){
                                "UPDATE $config[sql_check_table] SET Value = '$passwd' $text3 WHERE
                                Attribute = '$config[sql_password_attribute]' AND UserName = '$login';");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                                       echo "<b>Error while changing password</b><br>\n";      
+                                       echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n"; 
                        }
                        else{
                                $res = @da_sql_query($link,$config,
                                        "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName $text1)
                                        VALUES ('$config[sql_password_attribute]','$passwd','$login' $text2);");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                                       echo "<b>Error while changing password</b><br>\n";
+                                       echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
                }
                else
-                       echo "<b>Error while executing query</b><br>\n";
+                       echo "<b>Error while executing query: " . da_sql_error($link,$config) . "</b><br>\n";
        }
        else
                echo "<b>Could not open encryption library file</b><br>\n";
index 4fdebe4698cb6398125dda5144c0a9b243430884..9a0bdb2da4975c4e40a746f4fb7449421bd03514 100644 (file)
@@ -20,7 +20,7 @@ if ($link){
                        "INSERT INTO $config[sql_usergroup_table] (UserName,GroupName)
                        VALUES ('$member','$login');");
                        if (!$res || !@da_sql_affected_rows($link,$res,$config)){
-                               echo "<b>Unable to add user $member in group $login. SQL error</b><br>\n";
+                               echo "<b>Unable to add user $member in group $login: " . da_sql_error($link,$config) . "</b><br>\n";
                                $da_abort=1;
                        }
                }
@@ -53,7 +53,7 @@ if ($link){
                        "INSERT INTO $table (Attribute,Value,GroupName $text)
                        VALUES ('$attrmap[$key]','$val','$login' $op_val);");
                        if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                               echo "<b>Query failed for attribute $key</b><br>\n";
+                               echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
                }
        }
        echo "<b>Group created successfully</b><br>\n";
index b4392d6484731e587637abd1a2823e2ea454ed0a..19f996bdae0473a57d4e56af09a3eeacde4990bc 100644 (file)
@@ -20,7 +20,7 @@ if ($link){
                "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName $text)
                VALUES ('$config[sql_password_attribute]','$passwd','$login' $passwd_op);");
                if (!$res || !@da_sql_affected_rows($link,$res,$config)){
-                       echo "<b>Unable to add user $login. SQL error</b><br>\n";
+                       echo "<b>Unable to add user $login: " . da_sql_error($link,$config) . "</b><br>\n";
                        $da_abort=1;
                }
                if ($config[sql_use_user_info_table] == 'true' && !$da_abort){
@@ -34,13 +34,13 @@ if ($link){
                                        (UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES
                                        ('$login','$Fcn','$Fmail','$Fou','$Fhomephone','$Ftelephonenumber','$Fmobile');");
                                        if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                                               echo "<b>Could not add user information in user info table</b><br>\n";
+                                               echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
                                }
                                else
                                        echo "<b>User already exists in user info table.</b><br>\n";
                        }
                        else
-                               echo "<b>Could not add user information in user info table</b><br>\n";
+                               echo "<b>Could not add user information in user info table: " . da_sql_error($link,config) . "</b><br>\n";
                }
                if ($Fgroup != ''){
                        $res = @da_sql_query($link,$config,
@@ -58,7 +58,7 @@ if ($link){
                                        echo "<b>User already is a member of group $Fgroup</b><br>\n";
                        }
                        else
-                               echo "<b>Could not add user to group $Fgroup. SQL Error</b><br>\n";
+                               echo "<b>Could not add user to group $Fgroup: " . da_sql_error($link,$config) . "</b><br>\n";
                }
                if (!$da_abort){
                        foreach($show_attrs as $key => $attr){
@@ -88,7 +88,7 @@ if ($link){
                                "INSERT INTO $table (Attribute,Value,UserName $text)
                                VALUES ('$attrmap[$key]','$val','$login' $op_val);");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                                       echo "<b>Query failed for attribute $key</b><br>\n";
+                                       echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
                }
                echo "<b>User created successfully</b><br>\n";
index 917a13e96ddc43f03c6b04a2ba30dbfa5746a14a..cad79b69f907f7f4c64799f5fac16881cde0ee24 100644 (file)
@@ -18,13 +18,13 @@ if ($link){
                                if ($res)
                                        echo "<b>Group $login deleted successfully</b><br>\n";
                                else
-                                       echo "<b>Error deleting group $login from usergroup table</b><br>\n";
+                                       echo "<b>Error deleting group $login from usergroup table: " . da_sql_error($link,$config) . "</b><br>\n";
                }
                else
-                       echo "<b>Error deleting group $login from group check table</b><br>\n";
+                       echo "<b>Error deleting group $login from group check table: " . da_sql_error($link,$config) . "</b><br>\n";
        }
        else
-               echo "<b>Error deleting group $login from group reply table</b><br>\n";
+               echo "<b>Error deleting group $login from group reply table: " . da_sql_error($link,$config) . "</b><br>\n";
 }
 else
        echo "<b>Could not connect to database</b><br>\n";
index c068e1ffabe84bfb0a032a75fd10663a42d16718..b7431a6fe762e4b74fa3a04ec7b3c8c478ab20ba 100644 (file)
@@ -16,21 +16,21 @@ if ($link){
                        $res = @da_sql_query($link,$config,
                                "DELETE FROM $config[sql_usergroup_table] WHERE UserName = '$login';");
                        if (!$res)
-                               echo "<b>Error deleting user $login from user group table</b><br>\n";
+                               echo "<b>Error deleting user $login from user group table: " . da_sql_error($link,$config) . "</b><br>\n";
                        if ($config[sql_use_user_info_table] == 'true'){
                                $res = @da_sql_query($link,$config,
                                "DELETE FROM $config[sql_user_info_table] WHERE UserName = '$login';");
                                if ($res)
                                        echo "<b>User $login deleted successfully</b><br>\n";
                                else
-                                       echo "<b>Error deleting user $login from user info table</b><br>\n";
+                                       echo "<b>Error deleting user $login from user info table: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
                }
                else
-                       echo "<b>Error deleting user $login from check table</b><br>\n";
+                       echo "<b>Error deleting user $login from check table: " . da_sql_error($link,$config) . "</b><br>\n";
        }
        else
-               echo "<b>Error deleting user $login from reply table</b><br>\n";
+               echo "<b>Error deleting user $login from reply table: " . da_sql_error($link,$config) . "</b><br>\n";
 }
 else
        echo "<b>Could not connect to database</b><br>\n";
index 1e75eb914bc05717ec3065810c26a1dfb95320fc..94b78cc77452de8f95efa7eb0269ffc75e890d28 100644 (file)
@@ -12,7 +12,7 @@ if ($link){
                        $res = @da_sql_query($link,$config,
                        "DELETE FROM $config[sql_usergroup_table] WHERE UserName = '$del' AND GroupName = '$login';");
                        if (!$res)
-                               echo "<b>Could not delete user $del from group. SQL Error</b><br>\n";
+                               echo "<b>Could not delete user $del from group: " . da_sql_error($link,$config) . "</b><br>\n";
                }
        }
        if ($new_members != ''){
@@ -30,11 +30,11 @@ if ($link){
                                                "INSERT INTO $config[sql_usergroup_table] (GroupName,UserName)
                                                VALUES ('$login','$new_member');");
                                                if (!$res)
-                                                       echo "<b>Error while adding user $new_member to group</b><br>\n";
+                                                       echo "<b>Error while adding user $new_member to group: " . da_sql_error($link,$config) . "</b><br>\n";
                                        }
                                }
                                else
-                                       echo "<b>Could not add new member $new_member. SQL Error</b><br>\n";
+                                       echo "<b>Could not add new member $new_member: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
                }
        }