update
[phpmyadmin/crack.git] / tbl_properties_options.php3
blob6387ff8277043aaf3e4a733737326c5dc058953f
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 $url_query .= '&amp;goto=tbl_properties_options.php3&amp;back=tbl_properties_options.php3';
13 /**
14 * Updates table comment, type and options if required
16 if (isset($submitcomment)) {
17 if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
18 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
19 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
20 $message = $strSuccess;
23 if (isset($submittype)) {
24 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
25 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
26 $message = $strSuccess;
28 if (isset($submitoptions)) {
29 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
30 . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
31 . (isset($checksum) ? ' checksum=1': ' checksum=0')
32 . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0')
33 . (isset($auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($auto_increment) : '');
34 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
35 $message = $strSuccess;
38 // Displays a message if a query had been submitted
39 if (isset($message)) {
40 PMA_showMessage($message);
43 /**
44 * Gets tables informations and displays top links
46 require('./tbl_properties_table_info.php3');
48 /**
49 * Displays form controls
51 if (PMA_MYSQL_INT_VERSION >= 32322) {
53 <ul>
54 <!-- Table comments -->
55 <li>
56 <form method="post" action="tbl_properties_options.php3">
57 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
58 <?php echo $strTableComments; ?>&nbsp;:&nbsp;
59 <input type="hidden" name="prev_comment" value="<?php echo urlencode($show_comment); ?>" />&nbsp;
60 <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;
61 <input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
62 </form>
63 </li>
65 <!-- Table type -->
66 <?php
67 // modify robbat2 code - staybyte - 11. June 2001
68 $query = 'SHOW VARIABLES LIKE \'have_%\'';
69 $result = PMA_mysql_query($query);
70 if ($result != FALSE && mysql_num_rows($result) > 0) {
71 while ($tmp = PMA_mysql_fetch_array($result)) {
72 if (isset($tmp['Variable_name'])) {
73 switch ($tmp['Variable_name']) {
74 case 'have_bdb':
75 if ($tmp['Value'] == 'YES') {
76 $tbl_bdb = TRUE;
78 break;
79 case 'have_gemini':
80 if ($tmp['Value'] == 'YES') {
81 $tbl_gemini = TRUE;
83 break;
84 case 'have_innodb':
85 if ($tmp['Value'] == 'YES') {
86 $tbl_innodb = TRUE;
88 break;
89 case 'have_isam':
90 if ($tmp['Value'] == 'YES') {
91 $tbl_isam = TRUE;
93 break;
94 } // end switch
95 } // end if isset($tmp['Variable_name'])
96 } // end while
97 } // end if $result
99 mysql_free_result($result);
100 echo "\n";
102 <li>
103 <form method="post" action="tbl_properties_options.php3">
104 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
105 <?php echo $strTableType; ?>&nbsp;:&nbsp;
106 <select name="tbl_type" style="vertical-align: middle">
107 <option value="MYISAM"<?php if ($tbl_type == 'MYISAM') echo ' selected="selected"'; ?>>MyISAM</option>
108 <option value="HEAP"<?php if ($tbl_type == 'HEAP') echo ' selected="selected"'; ?>>Heap</option>
109 <?php
110 $tbl_types = "\n";
111 if (isset($tbl_bdb)) {
112 $tbl_types .= ' <option value="BDB"'
113 . (($tbl_type == 'BERKELEYDB') ? ' selected="selected"' : '')
114 . '>Berkeley DB</option>' . "\n";
116 if (isset($tbl_gemini)) {
117 $tbl_types .= ' <option value="GEMINI"'
118 . (($tbl_type == 'GEMINI') ? ' selected="selected"' : '')
119 . '>Gemini</option>' . "\n";
121 if (isset($tbl_innodb)) {
122 $tbl_types .= ' <option value="INNODB"'
123 . (($tbl_type == 'INNODB') ? ' selected="selected"' : '')
124 . '>INNO DB</option>' . "\n";
126 if (isset($tbl_isam)) {
127 $tbl_types .= ' <option value="ISAM"'
128 . (($tbl_type == 'ISAM') ? ' selected="selected"' : '')
129 . '>ISAM</option>' . "\n";
132 echo $tbl_types;
134 <option value="MERGE"<?php if ($tbl_type == 'MRG_MYISAM') echo ' selected="selected"'; ?>>Merge</option>
135 </select>&nbsp;
136 <input type="submit" name="submittype" value="<?php echo $strGo; ?>" style="vertical-align: middle" />&nbsp;
137 <?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
138 </form>
139 </li>
141 <!-- Table options -->
142 <li style="vertical-align: top">
143 <table border="0" cellspacing="0" cellpadding="0" style="vertical-align: top">
144 <tr>
145 <td valign="top">
146 <form method="post" action="tbl_properties_options.php3">
147 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
149 <table border="0" cellspacing="1" cellpadding="1">
150 <tr>
151 <td align="right"><input type="checkbox" name="pack_keys" id="pack_keys_opt"
152 <?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> /></td>
153 <td><label for="pack_keys_opt">pack_keys</label>&nbsp;&nbsp;</td>
154 </tr>
155 <tr>
156 <td align="right"><input type="checkbox" name="checksum" id="checksum_opt"
157 <?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> /></td>
158 <td><label for="checksum_opt">checksum</label>&nbsp;&nbsp;</td>
159 </tr>
160 <tr>
161 <td align="right"><input type="checkbox" name="delay_key_write" id="delay_key_write_opt"
162 <?php echo (isset($delay_key_write) && $delay_key_write == 1) ? ' checked="checked"' : ''; ?> /></td>
163 <td><label for="delay_key_write_opt">delay_key_write</label>&nbsp;&nbsp;</td>
164 </tr>
165 <tr>
166 <td><input type="text" name="auto_increment" id="auto_increment_opt" class="textfield" style="width: 30px"
167 <?php echo (isset($auto_increment) && !empty($auto_increment) ? ' value="' . $auto_increment . '"' : ''); ?> /></td>
168 <td valign="top"><label for="auto_increment_opt">auto_increment</label>&nbsp;&nbsp;<input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" /></td>
169 </tr>
170 </table>
171 </form>
172 </td>
173 </tr>
174 </table>
175 </li>
176 </ul>
177 <?php
178 } // end if (PMA_MYSQL_INT_VERSION >= 32322)
182 * Displays the footer
184 echo "\n";
185 require('./footer.inc.php3');