Fixed for quotes, HTML entities and other weird characters in db/table name.
[phpmyadmin/crack.git] / server_processlist.php3
blob605b31f6b7c11ebf681572d23219370353c5eef6
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 * Kills a selected process
15 if (!empty($kill)) {
16 $sql_query = 'KILL ' . $kill . ';';
17 if (@PMA_mysql_query($sql_query, $userlink)) {
18 $message = sprintf($strThreadSuccessfullyKilled, $kill);
19 } else {
20 $message = sprintf($strCouldNotKill, $kill);
25 /**
26 * Displays the links
28 require('./server_links.inc.php3');
31 /**
32 * Displays the sub-page heading
34 echo '<h2>' . "\n"
35 . ' ' . $strProcesslist . "\n"
36 . '</h2>' . "\n";
39 /**
40 * Sends the query and buffers the result
42 $serverProcesses = array();
43 $sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST;';
44 $res = @PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query);
45 while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) {
46 $serverProcesses[] = $row;
48 @mysql_free_result($res);
49 unset($res);
50 unset($row);
53 /**
54 * Displays the page
57 <table border="0">
58 <tr>
59 <th><?php echo PMA_MYSQL_INT_VERSION < 32307 ? '' : '<a href="./server_processlist.php3?'. $url_query . (empty($full) ? '&amp;full=1' : '') . '" title="' . (empty($full) ? $strShowFullQueries : $strTruncateQueries) . '"><img src="./images/' . (empty($full) ? 'full' : 'partial') . 'text.png" width="50" height="20" border="0" alt="' . (empty($full) ? $strShowFullQueries : $strTruncateQueries) . '" /></a>'; ?></th>
60 <th>&nbsp;<?php echo $strId; ?>&nbsp;</th>
61 <th>&nbsp;<?php echo $strUser; ?>&nbsp;</th>
62 <th>&nbsp;<?php echo $strHost; ?>&nbsp;</th>
63 <th>&nbsp;<?php echo $strDatabase; ?>&nbsp;</th>
64 <th>&nbsp;<?php echo $strCommand; ?>&nbsp;</th>
65 <th>&nbsp;<?php echo $strTime; ?>&nbsp;</th>
66 <th>&nbsp;<?php echo $strStatus; ?>&nbsp;</th>
67 <th>&nbsp;<?php echo $strSQLQuery; ?>&nbsp;</th>
68 </tr>
69 <?php
70 $useBgcolorOne = TRUE;
71 while (list($name, $value) = each($serverProcesses)) {
73 <tr>
74 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<a href="./server_processlist.php3?<?php echo $url_query . '&amp;kill=' . $value['Id']; ?>"><?php echo $strKill; ?></a>&nbsp;</td>
75 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo $value['Id']; ?>&nbsp;</td>
76 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $value['User']; ?>&nbsp;</td>
77 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $value['Host']; ?>&nbsp;</td>
78 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo (empty($value['db']) ? '<i>' . $strNone . '</i>' : $value['db']); ?>&nbsp;</td>
79 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $value['Command']; ?>&nbsp;</td>
80 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo $value['Time']; ?>&nbsp;</td>
81 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo (empty($value['State']) ? '---' : $value['State']); ?>&nbsp;</td>
82 <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo (empty($value['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($value['Info']))); ?>&nbsp;</td>
83 <?php
84 $useBgcolorOne = !$useBgcolorOne;
87 </tr>
88 <?php
90 </table>
91 <?php
94 /**
95 * Sends the footer
97 require('./footer.inc.php3');