6 * Prepares the work and runs some other scripts if required
8 if (!empty($submit_mult)
9 && (!empty($selected_db) ||
!empty($selected_tbl) ||
!empty($selected_fld))) {
11 if (get_magic_quotes_gpc()) {
12 $submit_mult = stripslashes($submit_mult);
14 if (!empty($selected_db)) {
15 $selected = $selected_db;
17 } else if (!empty($selected_tbl)) {
18 if ($submit_mult == $strPrintView) {
19 include('./tbl_printview.php3');
22 $selected = $selected_tbl;
23 switch ($submit_mult) {
30 case $strOptimizeTable:
32 $query_type = 'optimize_tbl';
33 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
38 $selected = $selected_fld;
39 if ($submit_mult == $strDrop) {
42 include('./tbl_alter.php3');
50 * Displays the confirmation form if required
52 if (!empty($submit_mult) && !empty($what)) {
55 $selected_cnt = count($selected);
56 for ($i = 0; $i < $selected_cnt; $i++
) {
59 $full_query .= 'DROP DATABASE '
60 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
65 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
66 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
67 . (($i == $selected_cnt - 1) ?
';<br />' : '');
70 // loic1: removed confirmation stage for "OPTIMIZE" statements
71 // case 'optimize_tbl':
72 // $full_query .= (empty($full_query) ? 'OPTIMIZE TABLE ' : ', ')
73 // . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
74 // . (($i == $selected_cnt - 1) ? ';<br />' : '');
78 $full_query .= 'DELETE FROM '
79 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
84 if ($full_query == '') {
85 $full_query .= 'ALTER TABLE '
86 . PMA_backquote(htmlspecialchars($table))
87 . '<br /> DROP '
88 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
91 $full_query .= '<br /> DROP '
92 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
95 if ($i == $selected_cnt-1) {
96 $full_query = ereg_replace(',$', ';<br />', $full_query);
103 echo $strDoYouReally . ' :<br />' . "\n";
104 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
106 <form action
="<?php echo $action; ?>" method
="post">
107 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
108 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
111 if ($action == 'db_details.php3') {
112 echo ' <input type="hidden" name="db" value="' . $db . '" />' . "\n";
113 } else if ($action == 'tbl_properties.php3') {
114 echo ' <input type="hidden" name="db" value="' . $db . '" />' . "\n";
115 echo ' <input type="hidden" name="table" value="' . $table . '" />' . "\n";
117 for ($i = 0; $i < $selected_cnt; $i++
) {
118 echo ' <input type="hidden" name="selected[]" value="' . $selected[$i] . '" />' . "\n";
121 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
122 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
123 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
128 include('./footer.inc.php3');
136 else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
137 ||
$mult_btn == $strYes) {
140 $selected_cnt = count($selected);
141 for ($i = 0; $i < $selected_cnt; $i++
) {
142 switch ($query_type) {
144 $a_query = 'DROP DATABASE '
145 . PMA_backquote(urldecode($selected[$i]));
150 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
151 . PMA_backquote(urldecode($selected[$i]))
152 . (($i == $selected_cnt-1) ?
';' : '');
157 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
158 . PMA_backquote(urldecode($selected[$i]))
159 . (($i == $selected_cnt-1) ?
';' : '');
163 $a_query = 'DELETE FROM '
164 . PMA_backquote(urldecode($selected[$i]));
168 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
169 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
170 . (($i == $selected_cnt-1) ?
';' : '');
174 // All "DROP TABLE","DROP FIELD" and "OPTIMIZE TABLE" statements will
175 // be run at once below
176 if ($query_type != 'drop_tbl'
177 && $query_type != 'drop_fld'
178 && $query_type != 'optimize_tbl') {
179 $sql_query .= $a_query . ';' . "\n";
181 if ($query_type != 'drop_db') {
182 mysql_select_db($db);
184 $result = @mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
188 if ($query_type == 'drop_tbl'
189 ||
$query_type == 'drop_fld'
190 ||
$query_type == 'optimize_tbl') {
191 mysql_select_db($db);
192 $result = @mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
195 PMA_showMessage($strSuccess);