here we go
<?php @mysql_connect("you-db-host","username","password"); if(isset($_GET['kill'])): mysql_unbuffered_query('kill '.$_GET['kill']); echo '<h1>Process Id : '.$_GET['kill'].' has been terminated</h1>'; endif; $sql = 'show full processlist'; echo ' <style> table { margin: 1em 20px 0 0; width: calc(100% - 40px); margin: 20px; } td, thead th { background: #fff; } </style> <table border="1" cellspacing="1" cellpadding="3"> <thead> <tr> <th title="">No</th> <th title="">Id</th> <th title="">User</th> <th title="">Host</th> <th title="">db</th> <th title="">Command</th> <th title="">Time</th> <th title="">State</th> <th title="">Info</th> </tr> </thead> <tbody>' ; $q = mysql_query("SHOW FULL PROCESSLIST"); $no = 1; while ($rs = mysql_fetch_assoc($q)) { echo ' <tr> <td>'.$no++.'</td> <td><a href="?kill='.$rs['Id'].'">'.$rs['Id'].'<?php ?></td> <td>'.$rs['User'].'</td> <td>'.$rs['Host'].'</td> <td>'.$rs['db'].'</td> <td>'.$rs['Command'].'</td> <td>'.$rs['Time'].'</td> <td>'.$rs['State'].'</td> <td><em>'.$rs['Info'].'</em></td> </tr>'; }; echo ' </tbody> </table> </body> </html> '; ?>
Comments are closed.