Handle hostnames with upper-case letters
[webmin.git] / mysql / drop_table.cgi
1 #!/usr/local/bin/perl
2 # drop_table.cgi
3 # Delete an existing table
4
5 require './mysql-lib.pl';
6 &ReadParse();
7 &can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
8 $access{'edonly'} && &error($text{'dbase_ecannot'});
9 if ($in{'confirm'}) {
10         # Drop the table
11         &error_setup($text{'tdrop_err'});
12         &execute_sql_logged($in{'db'}, "drop table ".&quotestr($in{'table'}));
13         &webmin_log("delete", "table", $in{'table'}, \%in);
14         &redirect("edit_dbase.cgi?db=$in{'db'}");
15         }
16 else {
17         # Ask the user if he is sure..
18         &ui_print_header(undef, $text{'tdrop_title'}, "");
19         @tables = &list_tables($in{'db'});
20         $d = &execute_sql($in{'db'},
21                 "select count(*) from ".&quotestr($in{'table'}));
22         $rows = $d->{'data'}->[0]->[0];
23
24         print "<center><b>",&text('tdrop_rusure', "<tt>$in{'table'}</tt>",
25                                   "<tt>$in{'db'}</tt>", $rows),"</b><p>\n";
26         print "<form action=drop_table.cgi>\n";
27         print "<input type=hidden name=db value='$in{'db'}'>\n";
28         print "<input type=hidden name=table value='$in{'table'}'>\n";
29         print "<input type=submit name=confirm value='$text{'tdrop_ok'}'>\n";
30         print "</form></center>\n";
31         &ui_print_footer("edit_table.cgi?db=$in{'db'}&table=$in{'table'}",
32                 $text{'table_return'},
33                 "edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'},
34                 "", $text{'index_return'});
35         }
36