]> git.somenet.org - ctf/pub/submit_bot.git/blob - flag_ids.php
modified: submitbot_tcp.py
[ctf/pub/submit_bot.git] / flag_ids.php
1 <?php
2 /** board script
3 * Displayes the submitted flag_ids of the
4 * last X time with meta information
5 * If the submission to gameserver was successfull (submitsuccess)
6 * and we got points for it (scoresuccess) it should be green bg
7 *
8 * 2014-15 by Jan "Someone" Vales <someone@somenet.org>
9 * do not publish!
10 */
11
12 $GLOBALS['db'] = new PDO('pgsql:host=localhost;port=5432;dbname=flagbot;user=flagbot;password=flagbotpw');
13 $GLOBALS['db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
14 $query = "SELECT service,count(*) as cnt FROM flag_ids WHERE (received + INTERVAL '30 minute') > now() group by service ORDER BY service";
15
16 ?>
17 <!DOCTYPE html>
18   <html>
19   <head>
20     <link rel="stylesheet" type="text/css" href="styles.css"></link>
21   </head>
22   <body>
23     <h1>Submission Board - flag_id - count()</h1>
24     <p><a href="./index.php">go to flags</a></p>
25     <p>Shows all submissions of the last 30 min<br>
26     NUM ROWS: <?php echo sizeof($GLOBALS['db']->query($query)->fetchAll()); ?></p>
27     <table style="width: 100%">
28       <thead>
29         <tr>
30             <th>service</th>
31             <th>count</th>
32           </tr>
33         </thead>
34         <tbody>
35           <?php
36           $stmt = $GLOBALS['db']->query($query);
37           while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
38           ?>
39             <tr class="score-<?php echo $row['service']; ?>">
40               <td><?php echo $row['service']; ?>&nbsp;</td>
41               <td><?php echo $row['cnt']; ?>&nbsp;</td>
42             </tr>
43             <?php
44           }
45           ?>
46         </tbody>
47       </table>
48     <p>Status: 0=new; 1=depleted</p>
49     </body>
50     </html>