bug 619097
[phpmyadmin/crack.git] / tbl_properties_options.php3
blob2858b2ee56b368de42ea435bbb61b057a1e8fd84
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Runs common work
8 */
9 require('./tbl_properties_common.php3');
10 $err_url = 'tbl_properties_options.php3' . $err_url;
11 $url_query .= '&amp;goto=tbl_properties_options.php3&amp;back=tbl_properties_options.php3';
14 /**
15 * Updates table comment, type and options if required
17 if (isset($submitcomment)) {
18 if (get_magic_quotes_gpc()) {
19 $comment = stripslashes($comment);
21 if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
22 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
23 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
24 $message = $strSuccess;
27 if (isset($submittype)) {
28 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
29 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
30 $message = $strSuccess;
32 if (isset($submitoptions)) {
33 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
34 . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
35 . (isset($checksum) ? ' checksum=1': ' checksum=0')
36 . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0');
37 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
38 $message = $strSuccess;
41 // Displays a message if a query had been submitted
42 if (isset($message)) {
43 PMA_showMessage((get_magic_quotes_gpc()) ? addslashes($message) : $message);
47 /**
48 * Gets tables informations and displays top links
50 require('./tbl_properties_table_info.php3');
53 /**
54 * Displays form controls
56 if (PMA_MYSQL_INT_VERSION >= 32322) {
58 <ul>
59 <!-- Table comments -->
60 <li>
61 <form method="post" action="tbl_properties_options.php3">
62 <input type="hidden" name="server" value="<?php echo $server; ?>" />
63 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
64 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
65 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
66 <?php echo $strTableComments; ?>&nbsp;:&nbsp;
67 <input type="hidden" name="prev_comment" value="<?php echo urlencode($show_comment); ?>" />&nbsp;
68 <input type="text" name="comment" maxlength="60" size="30" value="<?php echo htmlspecialchars($show_comment); ?>" class="textfield" style="vertical-align: middle" onfocus="this.select()" />&nbsp;
69 <input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
70 </form>
71 </li>
73 <!-- Table type -->
74 <?php
75 // modify robbat2 code - staybyte - 11. June 2001
76 $query = 'SHOW VARIABLES LIKE \'have_%\'';
77 $result = PMA_mysql_query($query);
78 if ($result != FALSE && mysql_num_rows($result) > 0) {
79 while ($tmp = PMA_mysql_fetch_array($result)) {
80 if (isset($tmp['Variable_name'])) {
81 switch ($tmp['Variable_name']) {
82 case 'have_bdb':
83 if ($tmp['Value'] == 'YES') {
84 $tbl_bdb = TRUE;
86 break;
87 case 'have_gemini':
88 if ($tmp['Value'] == 'YES') {
89 $tbl_gemini = TRUE;
91 break;
92 case 'have_innodb':
93 if ($tmp['Value'] == 'YES') {
94 $tbl_innodb = TRUE;
96 break;
97 case 'have_isam':
98 if ($tmp['Value'] == 'YES') {
99 $tbl_isam = TRUE;
101 break;
102 } // end switch
103 } // end if isset($tmp['Variable_name'])
104 } // end while
105 } // end if $result
107 mysql_free_result($result);
108 echo "\n";
110 <li>
111 <form method="post" action="tbl_properties_options.php3">
112 <input type="hidden" name="server" value="<?php echo $server; ?>" />
113 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
114 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
115 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
116 <?php echo $strTableType; ?>&nbsp;:&nbsp;
117 <select name="tbl_type" style="vertical-align: middle">
118 <option value="MYISAM"<?php if ($tbl_type == 'MYISAM') echo ' selected="selected"'; ?>>MyISAM</option>
119 <option value="HEAP"<?php if ($tbl_type == 'HEAP') echo ' selected="selected"'; ?>>Heap</option>
120 <?php
121 $tbl_types = "\n";
122 if (isset($tbl_bdb)) {
123 $tbl_types .= ' <option value="BDB"'
124 . (($tbl_type == 'BERKELEYDB') ? ' selected="selected"' : '')
125 . '>Berkeley DB</option>' . "\n";
127 if (isset($tbl_gemini)) {
128 $tbl_types .= ' <option value="GEMINI"'
129 . (($tbl_type == 'GEMINI') ? ' selected="selected"' : '')
130 . '>Gemini</option>' . "\n";
132 if (isset($tbl_innodb)) {
133 $tbl_types .= ' <option value="INNODB"'
134 . (($tbl_type == 'INNODB') ? ' selected="selected"' : '')
135 . '>INNO DB</option>' . "\n";
137 if (isset($tbl_isam)) {
138 $tbl_types .= ' <option value="ISAM"'
139 . (($tbl_type == 'ISAM') ? ' selected="selected"' : '')
140 . '>ISAM</option>' . "\n";
143 echo $tbl_types;
145 <option value="MERGE"<?php if ($tbl_type == 'MRG_MYISAM') echo ' selected="selected"'; ?>>Merge</option>
146 </select>&nbsp;
147 <input type="submit" name="submittype" value="<?php echo $strGo; ?>" style="vertical-align: middle" />&nbsp;
148 <?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
149 </form>
150 </li>
152 <!-- Table options -->
153 <li style="vertical-align: top">
154 <table border="0" cellspacing="0" cellpadding="0" style="vertical-align: top">
155 <tr>
156 <td valign="top">
157 <form method="post" action="tbl_properties_options.php3">
158 <input type="hidden" name="server" value="<?php echo $server; ?>" />
159 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
160 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
161 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
163 <table border="0" cellspacing="0" cellpadding="0">
164 <tr>
165 <td>
166 <input type="checkbox" name="pack_keys" id="pack_keys_opt"
167 <?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> />
168 <label for="pack_keys_opt">pack_keys</label>&nbsp;&nbsp;
169 <br />
170 <input type="checkbox" name="checksum" id="checksum_opt"
171 <?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> />
172 <label for="checksum_opt">checksum</label>&nbsp;&nbsp;
173 <br />
174 <input type="checkbox" name="delay_key_write" id="delay_key_write_opt"
175 <?php echo (isset($delay_key_write) && $delay_key_write == 1) ? ' checked="checked"' : ''; ?> />
176 <label for="delay_key_write_opt">delay_key_write</label>&nbsp;&nbsp;
177 &nbsp;&nbsp;
178 </td>
179 <td>
180 <input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
181 </td>
182 </tr>
183 </table>
184 </form>
185 </td>
186 </tr>
187 </table>
188 </li>
189 </ul>
190 <?php
191 } // end if (PMA_MYSQL_INT_VERSION >= 32322)
195 * Displays the footer
197 echo "\n";
198 require('./footer.inc.php3');