3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Prepares the work and runs some other scripts if required
9 if (!empty($submit_mult)
10 && (!empty($selected_db) ||
!empty($selected_tbl) ||
!empty($selected_fld))) {
12 if (get_magic_quotes_gpc()) {
13 $submit_mult = stripslashes($submit_mult);
15 if (!empty($selected_db)) {
16 $selected = $selected_db;
18 } else if (!empty($selected_tbl)) {
19 if ($submit_mult == $strPrintView) {
20 include('./tbl_printview.php3');
23 $selected = $selected_tbl;
24 switch ($submit_mult) {
31 case $strOptimizeTable:
33 $query_type = 'optimize_tbl';
34 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
38 $query_type = 'repair_tbl';
39 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
44 $selected = $selected_fld;
45 if ($submit_mult == $strDrop) {
48 include('./tbl_alter.php3');
56 * Displays the confirmation form if required
58 if (!empty($submit_mult) && !empty($what)) {
61 $selected_cnt = count($selected);
62 for ($i = 0; $i < $selected_cnt; $i++
) {
65 $full_query .= 'DROP DATABASE '
66 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
71 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
72 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
73 . (($i == $selected_cnt - 1) ?
';<br />' : '');
77 if (PMA_MYSQL_INT_VERSION
>= 40000) {
78 $full_query .= 'TRUNCATE ';
80 $full_query .= 'DELETE FROM ';
82 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
87 if ($full_query == '') {
88 $full_query .= 'ALTER TABLE '
89 . PMA_backquote(htmlspecialchars($table))
90 . '<br /> DROP '
91 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
94 $full_query .= '<br /> DROP '
95 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
98 if ($i == $selected_cnt-1) {
99 $full_query = ereg_replace(',$', ';<br />', $full_query);
106 echo $strDoYouReally . ' :<br />' . "\n";
107 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
109 <form action
="<?php echo $action; ?>" method
="post">
110 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
111 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
112 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
115 if (strpos(' ' . $action, 'db_details') == 1) {
116 echo ' <input type="hidden" name="db" value="' . htmlspecialchars($db) . '" />' . "\n";
117 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
118 echo ' <input type="hidden" name="db" value="' . htmlspecialchars($db) . '" />' . "\n";
119 echo ' <input type="hidden" name="table" value="' . htmlspecialchars($table) . '" />' . "\n";
121 for ($i = 0; $i < $selected_cnt; $i++
) {
122 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
125 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
126 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
127 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
132 include('./footer.inc.php3');
140 else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
141 ||
$mult_btn == $strYes) {
144 $selected_cnt = count($selected);
145 for ($i = 0; $i < $selected_cnt; $i++
) {
146 switch ($query_type) {
148 $a_query = 'DROP DATABASE '
149 . PMA_backquote(urldecode($selected[$i]));
154 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
155 . PMA_backquote(urldecode($selected[$i]))
156 . (($i == $selected_cnt-1) ?
';' : '');
161 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
162 . PMA_backquote(urldecode($selected[$i]))
163 . (($i == $selected_cnt-1) ?
';' : '');
167 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
168 . PMA_backquote(urldecode($selected[$i]))
169 . (($i == $selected_cnt-1) ?
';' : '');
173 $a_query = 'DELETE FROM '
174 . PMA_backquote(urldecode($selected[$i]));
178 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
179 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
180 . (($i == $selected_cnt-1) ?
';' : '');
184 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
185 // statements will be run at once below
186 if ($query_type != 'drop_tbl'
187 && $query_type != 'drop_fld'
188 && $query_type != 'repair_tbl'
189 && $query_type != 'optimize_tbl') {
190 $sql_query .= $a_query . ';' . "\n";
192 if ($query_type != 'drop_db') {
193 PMA_mysql_select_db($db);
195 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
199 if ($query_type == 'drop_tbl'
200 ||
$query_type == 'drop_fld'
201 ||
$query_type == 'repair_tbl'
202 ||
$query_type == 'optimize_tbl') {
203 PMA_mysql_select_db($db);
204 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
207 PMA_showMessage($strSuccess);