2007-04-12 20:24:50 +00:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
# Drop a bunch of fields
|
|
|
|
|
|
|
|
require './mysql-lib.pl';
|
|
|
|
&ReadParse();
|
2009-01-09 00:08:09 +00:00
|
|
|
&error_setup($text{'fdrop_err'});
|
2007-04-12 20:24:50 +00:00
|
|
|
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
|
|
|
|
$access{'edonly'} && &error($text{'dbase_ecannot'});
|
|
|
|
|
|
|
|
# Validate inputs
|
|
|
|
@d = split(/\0/, $in{'d'});
|
|
|
|
@d || &error($text{'fdrop_enone'});
|
|
|
|
@desc = &table_structure($in{'db'}, $in{'table'});
|
|
|
|
@d < @desc || &error($text{'fdrop_eall'});
|
|
|
|
|
|
|
|
# Do the deed
|
|
|
|
foreach $d (@d) {
|
|
|
|
&execute_sql_logged($in{'db'},
|
|
|
|
"alter table "."estr($in{'table'})." drop "."estr($d));
|
|
|
|
}
|
|
|
|
&webmin_log("delete", "fields", scalar(@d), \%in);
|
|
|
|
&redirect("edit_table.cgi?db=$in{'db'}&table=".&urlize($in{'table'}));
|
|
|
|
|