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);
37 $query_type = 'repair_tbl';
38 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
43 $selected = $selected_fld;
44 if ($submit_mult == $strDrop) {
47 include('./tbl_alter.php3');
55 * Displays the confirmation form if required
57 if (!empty($submit_mult) && !empty($what)) {
60 $selected_cnt = count($selected);
61 for ($i = 0; $i < $selected_cnt; $i++
) {
64 $full_query .= 'DROP DATABASE '
65 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
70 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
71 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
72 . (($i == $selected_cnt - 1) ?
';<br />' : '');
76 if (PMA_MYSQL_INT_VERSION
>= 40000) {
77 $full_query .= 'TRUNCATE ';
79 $full_query .= 'DELETE FROM ';
81 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
86 if ($full_query == '') {
87 $full_query .= 'ALTER TABLE '
88 . PMA_backquote(htmlspecialchars($table))
89 . '<br /> DROP '
90 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
93 $full_query .= '<br /> DROP '
94 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
97 if ($i == $selected_cnt-1) {
98 $full_query = ereg_replace(',$', ';<br />', $full_query);
105 echo $strDoYouReally . ' :<br />' . "\n";
106 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
108 <form action
="<?php echo $action; ?>" method
="post">
109 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
110 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
111 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
114 if (strpos(' ' . $action, 'db_details') == 1) {
115 echo ' <input type="hidden" name="db" value="' . $db . '" />' . "\n";
116 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
117 echo ' <input type="hidden" name="db" value="' . $db . '" />' . "\n";
118 echo ' <input type="hidden" name="table" value="' . $table . '" />' . "\n";
120 for ($i = 0; $i < $selected_cnt; $i++
) {
121 echo ' <input type="hidden" name="selected[]" value="' . $selected[$i] . '" />' . "\n";
124 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
125 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
126 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
131 include('./footer.inc.php3');
139 else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
140 ||
$mult_btn == $strYes) {
143 $selected_cnt = count($selected);
144 for ($i = 0; $i < $selected_cnt; $i++
) {
145 switch ($query_type) {
147 $a_query = 'DROP DATABASE '
148 . PMA_backquote(urldecode($selected[$i]));
153 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
154 . PMA_backquote(urldecode($selected[$i]))
155 . (($i == $selected_cnt-1) ?
';' : '');
160 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
161 . PMA_backquote(urldecode($selected[$i]))
162 . (($i == $selected_cnt-1) ?
';' : '');
166 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
167 . PMA_backquote(urldecode($selected[$i]))
168 . (($i == $selected_cnt-1) ?
';' : '');
172 $a_query = 'DELETE FROM '
173 . PMA_backquote(urldecode($selected[$i]));
177 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
178 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
179 . (($i == $selected_cnt-1) ?
';' : '');
183 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
184 // statements will be run at once below
185 if ($query_type != 'drop_tbl'
186 && $query_type != 'drop_fld'
187 && $query_type != 'repair_tbl'
188 && $query_type != 'optimize_tbl') {
189 $sql_query .= $a_query . ';' . "\n";
191 if ($query_type != 'drop_db') {
192 PMA_mysql_select_db($db);
194 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
198 if ($query_type == 'drop_tbl'
199 ||
$query_type == 'drop_fld'
200 ||
$query_type == 'repair_tbl'
201 ||
$query_type == 'optimize_tbl') {
202 PMA_mysql_select_db($db);
203 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
206 PMA_showMessage($strSuccess);