undefined variable cfg nopassword in mysqli
[phpmyadmin/crack.git] / db_printview.php
blob46d5ae6ca913b7b65412cde24dc9a46df9715c63
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 require_once('./libraries/common.lib.php');
7 /**
8 * Gets the variables sent or posted to this script, then displays headers
9 */
10 $print_view = TRUE;
11 require_once('./libraries/header.inc.php');
14 PMA_checkParameters(array('db'));
16 /**
17 * Defines the url to return to in case of error in a sql statement
19 $err_url = 'db_details.php?' . PMA_generate_common_url($db);
21 /**
22 * Settings for relations stuff
24 require_once('./libraries/relation.lib.php');
25 $cfgRelation = PMA_getRelationsParam();
27 /**
28 * Gets the list of the table in the current db and informations about these
29 * tables if possible
31 // staybyte: speedup view on locked tables - 11 June 2001
32 // Special speedup for newer MySQL Versions (in 4.0 format changed)
33 if ($cfg['SkipLockedTables'] == TRUE) {
34 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
35 // Blending out tables in use
36 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
37 while ($tmp = PMA_DBI_fetch_row($result)) {
38 // if in use memorize tablename
39 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
40 $sot_cache[$tmp[0]] = TRUE;
43 PMA_DBI_free_result($result);
44 unset($result);
46 if (isset($sot_cache)) {
47 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
48 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
49 while ($tmp = PMA_DBI_fetch_row($result)) {
50 if (!isset($sot_cache[$tmp[0]])) {
51 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
52 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
53 $tables[] = $sts_tmp;
54 } else { // table in use
55 $tables[] = array('Name' => $tmp[0]);
58 PMA_DBI_free_result($result);
59 unset($result);
60 $sot_ready = TRUE;
65 if (!isset($sot_ready)) {
66 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
67 if (PMA_DBI_num_rows($result) > 0) {
68 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
69 $tables[] = $sts_tmp;
71 PMA_DBI_free_result($result);
72 unset($res);
75 $num_tables = (isset($tables) ? count($tables) : 0);
77 if ($cfgRelation['commwork']) {
78 $comment = PMA_getComments($db);
80 /**
81 * Displays DB comment
83 if (is_array($comment)) {
85 <!-- DB comment -->
86 <p><i>
87 <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?>
88 </i></p>
89 <?php
90 } // end if
93 /**
94 * If there is at least one table, displays the printer friendly view, else
95 * an error message
97 // 1. No table
98 if ($num_tables == 0) {
99 echo $strNoTablesFound;
101 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
102 else {
105 <!-- The tables list -->
106 <table border="<?php echo $cfg['Border']; ?>">
107 <tr>
108 <th>&nbsp;<?php echo $strTable; ?>&nbsp;</th>
109 <th><?php echo $strRecords; ?></th>
110 <th><?php echo $strType; ?></th>
111 <?php
112 if ($cfg['ShowStats']) {
113 echo '<th>' . $strSize . '</th>';
115 echo "\n";
117 <th><?php echo $strComments; ?></th>
118 </tr>
119 <?php
120 $i = $sum_entries = $sum_size = 0;
121 foreach ($tables AS $keyname => $sts_data) {
122 $table = $sts_data['Name'];
123 $bgcolor = ($i++ % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
124 echo "\n";
126 <tr>
127 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
128 &nbsp;<b><?php echo htmlspecialchars($table); ?>&nbsp;</b>&nbsp;
129 </td>
130 <?php
131 echo "\n";
132 $mergetable = FALSE;
133 $nonisam = FALSE;
134 if (isset($sts_data['Type'])) {
135 if ($sts_data['Type'] == 'MRG_MyISAM') {
136 $mergetable = TRUE;
137 } elseif (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
138 $nonisam = TRUE;
142 if (isset($sts_data['Rows'])) {
143 if ($mergetable == FALSE) {
144 if ($cfg['ShowStats'] && $nonisam == FALSE) {
145 $tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
146 $sum_size += $tblsize;
147 if ($tblsize > 0) {
148 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
149 } else {
150 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
152 } elseif ($cfg['ShowStats']) {
153 $formated_size = '&nbsp;-&nbsp;';
154 $unit = '';
156 $sum_entries += $sts_data['Rows'];
158 // MyISAM MERGE Table
159 elseif ($cfg['ShowStats'] && $mergetable == TRUE) {
160 $formated_size = '&nbsp;-&nbsp;';
161 $unit = '';
162 } elseif ($cfg['ShowStats']) {
163 $formated_size = 'unknown';
164 $unit = '';
167 <td align="right" bgcolor="<?php echo $bgcolor; ?>">
168 <?php
169 echo "\n" . ' ';
170 if ($mergetable == TRUE) {
171 echo '<i>' . number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
172 } else {
173 echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
176 </td>
177 <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>">
178 &nbsp;<?php echo (isset($sts_data['Type']) ? $sts_data['Type'] : '&nbsp;'); ?>&nbsp;
179 </td>
180 <?php
181 if ($cfg['ShowStats']) {
182 echo "\n";
184 <td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
185 &nbsp;<?php echo $formated_size . ' ' . $unit . "\n"; ?>
186 </td>
187 <?php
188 echo "\n";
189 } // end if
190 } else {
192 <td colspan="3" align="center" bgcolor="<?php echo $bgcolor; ?>">
193 <?php echo $strInUse . "\n"; ?>
194 </td>
195 <?php
197 echo "\n";
199 <td bgcolor="<?php echo $bgcolor; ?>">
200 <?php echo $sts_data['Comment']; ?>
201 <?php
202 if (!empty($sts_data['Comment'])) {
203 $needs_break = '<br />';
204 } else {
205 $needs_break = '';
208 if ((isset($sts_data['Create_time']) && !empty($sts_data['Create_time']))
209 || (isset($sts_data['Update_time']) && !empty($sts_data['Update_time']))
210 || (isset($sts_data['Check_time']) && !empty($sts_data['Check_time']))) {
211 echo $needs_break;
213 <table border="0" cellpadding="1" cellspacing="1" width="100%" class="noborder">
214 <?php
216 if (isset($sts_data['Create_time']) && !empty($sts_data['Create_time'])) {
218 <tr>
219 <td style="font-size: 80%" align="right"><?php echo $strStatCreateTime . ': '; ?></td>
220 <td style="font-size: 80%" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?></td>
221 </tr>
222 <?php
225 if (isset($sts_data['Update_time']) && !empty($sts_data['Update_time'])) {
227 <tr>
228 <td style="font-size: 80%" align="right"><?php echo $strStatUpdateTime . ': '; ?></td>
229 <td style="font-size: 80%" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?></td>
230 </tr>
231 <?php
234 if (isset($sts_data['Check_time']) && !empty($sts_data['Check_time'])) {
236 <tr>
237 <td style="font-size: 80%" align="right"><?php echo $strStatCheckTime . ': '; ?></td>
238 <td style="font-size: 80%" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?></td>
239 </tr>
240 <?php
243 </table>
244 <?php
247 </td>
248 </tr>
249 <?php
251 // Show Summary
252 if ($cfg['ShowStats']) {
253 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
255 echo "\n";
257 <tr>
258 <th align="center">
259 &nbsp;<b><?php echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?></b>&nbsp;
260 </th>
261 <th align="right" nowrap="nowrap">
262 <b><?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?></b>
263 </th>
264 <th align="center">
265 <b>--</b>
266 </th>
267 <?php
268 if ($cfg['ShowStats']) {
269 echo "\n";
271 <th align="right" nowrap="nowrap">
272 <b><?php echo $sum_formated . ' ' . $unit; ?></b>
273 </th>
274 <?php
276 echo "\n";
278 <th>&nbsp;</th>
279 </tr>
280 </table>
281 <?php
285 * Displays the footer
287 echo "\n";
289 <script type="text/javascript" language="javascript">
290 //<![CDATA[
291 function printPage()
293 // Do print the page
294 if (typeof(window.print) != 'undefined') {
295 window.print();
298 //]]>
299 </script>
300 <?php
301 echo '<br /><br />&nbsp;<input type="button" class="print_ignore" style="width: 100px; height: 25px" id="print" value="' . $strPrint . '" onclick="printPage()" />' . "\n";
303 require_once('./libraries/footer.inc.php');