1#!/usr/local/bin/perl
2# Drop a bunch of fields
3
4require './mysql-lib.pl';
5&ReadParse();
6&error_setup($text{'fdrop_err'});
7&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
8$access{'edonly'} && &error($text{'dbase_ecannot'});
9
10# Validate inputs
11@d = split(/\0/, $in{'d'});
12@d || &error($text{'fdrop_enone'});
13@desc = &table_structure($in{'db'}, $in{'table'});
14@d < @desc || &error($text{'fdrop_eall'});
15
16# Do the deed
17foreach $d (@d) {
18	&execute_sql_logged($in{'db'},
19	    "alter table ".&quotestr($in{'table'})." drop ".&quotestr($d));
20	}
21&webmin_log("delete", "fields", scalar(@d), \%in);
22&redirect("edit_table.cgi?db=$in{'db'}&table=".&urlize($in{'table'}));
23
24