(it) Updates
[phpmyadmin/crack.git] / server_status.php3
blobf2a1a35ef16b48ca5ba9679c0462037b468239ce
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Does the common work
8 */
9 require('./server_common.inc.php3');
12 /**
13 * Displays the links
15 require('./server_links.inc.php3');
18 /**
19 * Displays the sub-page heading
21 echo '<h2>' . "\n"
22 . ' ' . $strServerStatus . "\n"
23 . '</h2>' . "\n";
26 /**
27 * Checks if the user is allowed to do what he tries to...
29 if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
30 echo $strNoPrivileges;
31 include('./footer.inc.php3');
32 exit;
36 /**
37 * Sends the query and buffers the result
39 $res = @PMA_mysql_query('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW STATUS;');
40 while ($row = PMA_mysql_fetch_row($res)) {
41 $serverStatus[$row[0]] = $row[1];
43 @mysql_free_result($res);
44 unset($res);
45 unset($row);
48 /**
49 * Displays the page
51 //Uptime calculation
52 $res = @PMA_mysql_query('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
53 $row = PMA_mysql_fetch_row($res);
54 echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
55 mysql_free_result($res);
56 unset($res);
57 unset($row);
58 //Get query statistics
59 $queryStats = array();
60 $tmp_array = $serverStatus;
61 while (list($name, $value) = each($tmp_array)) {
62 if (substr($name, 0, 4) == 'Com_') {
63 $queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
64 unset($serverStatus[$name]);
67 unset($tmp_array);
69 <ul>
70 <li>
71 <!-- Server Traffic -->
72 <?php echo $strServerTrafficNotes; ?><br />
73 <table border="0">
74 <tr>
75 <td valign="top">
76 <table border="0">
77 <tr>
78 <th colspan="2">&nbsp;<?php echo $strTraffic; ?>&nbsp;</th>
79 <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
80 </tr>
81 <tr>
82 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strReceived; ?>&nbsp;</td>
83 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'])); ?>&nbsp;</td>
84 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
85 </tr>
86 <tr>
87 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strSent; ?>&nbsp;</td>
88 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'])); ?>&nbsp;</td>
89 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
90 </tr>
91 <tr>
92 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">&nbsp;<?php echo $strTotalUC; ?>&nbsp;</td>
93 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent'])); ?>&nbsp;</td>
94 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
95 </tr>
96 </table>
97 </td>
98 <td valign="top">
99 <table border="0">
100 <tr>
101 <th colspan="2">&nbsp;<?php echo $strConnections; ?>&nbsp;</th>
102 <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
103 <th>&nbsp;%&nbsp;</th>
104 </tr>
105 <tr>
106 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strFailedAttempts; ?>&nbsp;</td>
107 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_connects'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
108 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_connects'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
109 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_connects'] * 100 / $serverStatus['Connections']), 2, $number_decimal_separator, $number_thousands_separator) . '&nbsp;%' : '---'; ?>&nbsp;</td>
110 </tr>
111 <tr>
112 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strAbortedClients; ?>&nbsp;</td>
113 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_clients'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
114 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_clients'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
115 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_clients'] * 100 / $serverStatus['Connections']), 2 , $number_decimal_separator, $number_thousands_separator) . '&nbsp;%' : '---'; ?>&nbsp;</td>
116 </tr>
117 <tr>
118 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">&nbsp;<?php echo $strTotalUC; ?>&nbsp;</td>
119 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Connections'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
120 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Connections'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
121 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;100,00&nbsp;%&nbsp;</td>
122 </tr>
123 </table>
124 </td>
125 </tr>
126 </table>
127 </li>
128 <br />
129 <li>
130 <!-- Queries -->
131 <?php echo sprintf($strQueryStatistics, number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator)); ?><br />
132 <table border="0">
133 <tr>
134 <td valign="top">
135 <table border="0">
136 <tr>
137 <th colspan="2">&nbsp;<?php echo $strQueryType; ?>&nbsp;</th>
138 <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
139 <th>&nbsp;%&nbsp;</th>
140 </tr>
141 <?php
143 $useBgcolorOne = TRUE;
144 $countRows = 0;
145 while (list($name, $value) = each($queryStats)) {
147 <tr>
148 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo htmlspecialchars($name); ?>&nbsp;</td>
149 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($value, 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
150 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($value * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
151 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($value * 100 / $serverStatus['Questions']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;%&nbsp;</td>
152 </tr>
153 <?php
154 $useBgcolorOne = !$useBgcolorOne;
155 if (++$countRows == ceil(count($queryStats) / 2)) {
156 $useBgcolorOne = TRUE;
158 </table>
159 </td>
160 <td valign="top">
161 <table border="0">
162 <tr>
163 <th colspan="2">&nbsp;<?php echo $strQueryType; ?>&nbsp;</th>
164 <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
165 <th>&nbsp;%&nbsp;</th>
166 </tr>
167 <?php
170 unset($countRows);
171 unset($useBgcolorOne);
174 </table>
175 </td>
176 </tr>
177 </table>
178 </li>
179 <?php
180 //Unset used variables
181 unset($serverStatus['Aborted_clients']);
182 unset($serverStatus['Aborted_connects']);
183 unset($serverStatus['Bytes_received']);
184 unset($serverStatus['Bytes_sent']);
185 unset($serverStatus['Connections']);
186 unset($serverStatus['Questions']);
187 unset($serverStatus['Uptime']);
189 if (!empty($serverStatus)) {
191 <br />
192 <li>
193 <!-- Other status variables -->
194 <b><?php echo $strMoreStatusVars; ?></b><br />
195 <table border="0">
196 <tr>
197 <td valign="top">
198 <table border="0">
199 <tr>
200 <th>&nbsp;<?php echo $strVar; ?>&nbsp;</th>
201 <th>&nbsp;<?php echo $strValue; ?>&nbsp;</th>
202 </tr>
203 <?php
204 $useBgcolorOne = TRUE;
205 $countRows = 0;
206 while (list($name, $value) = each($serverStatus)) {
208 <tr>
209 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?>&nbsp;</td>
210 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo htmlspecialchars($value); ?>&nbsp;</td>
211 </tr>
212 <?php
213 $useBgcolorOne = !$useBgcolorOne;
214 if (++$countRows == ceil(count($serverStatus) / 3) || $countRows == ceil(count($serverStatus) * 2 / 3)) {
215 $useBgcolorOne = TRUE;
217 </table>
218 </td>
219 <td valign="top">
220 <table border="0">
221 <tr>
222 <th>&nbsp;<?php echo $strVar; ?>&nbsp;</th>
223 <th>&nbsp;<?php echo $strValue; ?>&nbsp;</th>
224 </tr>
225 <?php
228 unset($useBgcolorOne);
230 </table>
231 </td>
232 </tr>
233 </table>
234 </li>
235 <?php
238 </ul>
241 <?php
245 * Sends the footer
247 require('./footer.inc.php3');