]> git.somenet.org - ctf/pub/submit_bot.git/blob - index_flag_ids.php
post-ictf
[ctf/pub/submit_bot.git] / index_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 * FROM flag_ids WHERE (received + INTERVAL '30 minute') > now() ORDER BY received DESC";
15
16 ?>
17 <!DOCTYPE html>
18   <html>
19   <head>
20     <link rel="stylesheet" type="text/css" href="styles.css"></link>
21     <meta http-equiv="refresh" content="10;">
22   </head>
23   <body>
24     <h1>Submission Board - flag_ids</h1>
25 <p><a href="./index.php">Flags</a>
26 <a href="./index_serviceflags.php">Service + Exploit flags</a> <a href="./index_serviceflags.php?all">Alltime Service + Exploit flags</a>
27 <a href="./index_flag_ids.php">Flag_IDs</a></p>
28     <p>Shows all submissions of the last 30 min. <b>Current Time: <?php echo ' '.date('Y-m-d H:i:s');?></b><br>
29     NUM ROWS: <?php echo sizeof($GLOBALS['db']->query($query)->fetchAll()); ?></p>
30     <table style="width: 100%">
31       <thead>
32         <tr>
33             <th>service</th>
34             <th>team</th>
35             <th>flag_id</th>
36             <th>received</th>
37             <th>status</th>
38           </tr>
39         </thead>
40         <tbody>
41           <?php
42           $stmt = $GLOBALS['db']->query($query);
43           while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
44           ?>
45             <tr class="score-<?php echo $row['status']; ?>">
46               <td><?php echo $row['service']; ?>&nbsp;</td>
47               <td><?php echo $row['team']; ?>&nbsp;</td>
48               <td><?php echo $row['flag_id']; ?>&nbsp;</td>
49               <td><?php echo $row['host']; ?>&nbsp;</td>
50               <td><?php echo $row['received']; ?></td>
51               <td><?php echo $row['status']; ?></td>
52             </tr>
53             <?php
54           }
55           ?>
56         </tbody>
57       </table>
58     <p>Status: 0=new; 1=depleted</p>
59     </body>
60     </html>