refresh
[phpmyadmin/crack.git] / tbl_printview.php3
blobf5093bfd6c4f30942116f9f2feefd088549ecc45
1 <?php
2 /* $Id$ */
5 /**
6 * Gets the variables sent or posted to this script, then displays headers
7 */
8 require('./grab_globals.inc.php3');
9 if (!isset($message)) {
10 include('./header.inc.php3');
11 } else {
12 show_message($message);
14 unset($sql_query);
17 /**
18 * Selects the database
20 mysql_select_db($db);
23 /**
24 * Displays the comments of the table is MySQL >= 3.23
26 if (MYSQL_MAJOR_VERSION >= 3.23) {
27 $result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die();
28 $row = mysql_fetch_array($result);
29 if (!empty($row['Comment'])) {
30 echo $strTableComments . '&nbsp;:&nbsp;' . $row['Comment'];
32 } // end display comments
35 /**
36 * Displays the table structure
38 // Gets fields properties
39 $result = mysql_query('SHOW FIELDS FROM ' . backquote($table)) or mysql_die();
42 <!-- TABLE INFORMATIONS -->
43 <table border="<?php echo $cfgBorder; ?>">
44 <tr>
45 <th><?php echo ucfirst($strField); ?></th>
46 <th><?php echo ucfirst($strType); ?></th>
47 <th><?php echo ucfirst($strAttr); ?></th>
48 <th><?php echo ucfirst($strNull); ?></th>
49 <th><?php echo ucfirst($strDefault); ?></th>
50 <th><?php echo ucfirst($strExtra); ?></th>
51 </tr>
53 <?php
54 $i = 0;
55 while ($row = mysql_fetch_array($result)) {
56 $bgcolor = ($i % 2) ?$cfgBgcolorOne : $cfgBgcolorTwo;
57 $i++;
59 $type = $row['Type'];
60 // reformat mysql query output - staybyte - 9. June 2001
61 $shorttype = substr($type, 0, 3);
62 if ($shorttype == 'set' || $shorttype == 'enu') {
63 $type = eregi_replace(',', ', ', $type);
64 $type_nowrap = '';
65 } else {
66 $type_nowrap = ' nowrap="nowrap"';
68 $type = eregi_replace('BINARY', '', $type);
69 $type = eregi_replace('ZEROFILL', '', $type);
70 $type = eregi_replace('UNSIGNED', '', $type);
71 if (empty($type)) {
72 $type = '&nbsp;';
75 $binary = eregi('BINARY', $row['Type'], $test);
76 $unsigned = eregi('UNSIGNED', $row['Type'], $test);
77 $zerofill = eregi('ZEROFILL', $row['Type'], $test);
78 $strAttribute = '&nbsp;';
79 if ($binary) {
80 $strAttribute = 'BINARY';
82 if ($unsigned) {
83 $strAttribute = 'UNSIGNED';
85 if ($zerofill) {
86 $strAttribute = 'UNSIGNED ZEROFILL';
88 echo "\n";
90 <tr bgcolor="<?php echo $bgcolor; ?>">
91 <td nowrap="nowrap"><?php echo htmlspecialchars($row['Field']); ?>&nbsp;</td>
92 <td<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
93 <td nowrap="nowrap"><?php echo $strAttribute; ?></td>
94 <td><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
95 <td nowrap="nowrap"><?php if (isset($row['Default'])) echo htmlspecialchars($row['Default']); ?>&nbsp;</td>
96 <td nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
97 </tr>
98 <?php
99 } // end while
100 echo "\n";
102 </table>
105 <?php
107 * Displays indexes
109 $result = mysql_query('SHOW KEYS FROM ' . backquote($table)) or mysql_die();
110 if (mysql_num_rows($result) > 0) {
113 <!-- Indexes -->
114 <br />
115 <?php echo $strIndexes . '&nbsp;:' . "\n"; ?>
116 <table border="<?php echo $cfgBorder; ?>">
117 <tr>
118 <th><?php echo $strKeyname; ?></th>
119 <th><?php echo $strUnique; ?></th>
120 <th><?php echo $strField; ?></th>
121 </tr>
122 <?php
123 for ($i = 0 ; $i < mysql_num_rows($result); $i++) {
124 $row = mysql_fetch_array($result);
125 echo "\n";
127 <tr>
128 <td><?php echo htmlspecialchars($row['Key_name']) . "\n"; ?></td>
129 <td><?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?></td>
130 <td><?php echo htmlspecialchars($row['Column_name']) . "\n"; ?></td>
131 </tr>
132 <?php
133 } // end for
134 echo "\n";
136 </table>
137 <?php
138 } // end if
142 * Displays the footer
144 echo "\n";
145 require('./footer.inc.php3');