update
[phpmyadmin/crack.git] / tbl_properties_options.php3
blobe6edbc3457044cfc9135339838be74ef12d22660
1 <?php
2 /* $Id$ */
5 /**
6 * Runs common work
7 */
8 require('./tbl_properties_common.php3');
9 $err_url = 'tbl_properties_options.php3' . $err_url;
10 $url_query .= '&amp;back=tbl_properties_options.php3';
13 /**
14 * Updates table comment, type and options if required
16 if (isset($submitcomment)) {
17 if (get_magic_quotes_gpc()) {
18 $comment = stripslashes($comment);
20 if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
21 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
22 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
23 $message = $strSuccess;
26 if (isset($submittype)) {
27 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
28 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
29 $message = $strSuccess;
31 if (isset($submitoptions)) {
32 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
33 . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
34 . (isset($checksum) ? ' checksum=1': ' checksum=0')
35 . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0');
36 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
37 $message = $strSuccess;
40 // Displays a message if a query had been submitted
41 if (isset($message)) {
42 PMA_showMessage((get_magic_quotes_gpc()) ? addslashes($message) : $message);
46 /**
47 * Gets tables informations and displays top links
49 $sub_part = '_options';
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 $db; ?>" />
65 <input type="hidden" name="table" value="<?php echo $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 $db; ?>" />
115 <input type="hidden" name="table" value="<?php echo $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 $db; ?>" />
161 <input type="hidden" name="table" value="<?php echo $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');