]> git.somenet.org - ctf/pub/submit_bot.git/blob - index.php
modified: submitbot_tcp.py
[ctf/pub/submit_bot.git] / index.php
1 <?php
2 /** board script
3 * Displayes the submitted flowIDs 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 flags WHERE not (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   </head>
22   <body>
23     <h1>Submission Board - Flags</h1>
24     <p><a href="./index_flag_ids.php">go to flag_ids</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>fid</th>
31             <th>flag</th>
32             <th>service</th>
33             <th>flag_id</th>
34             <th>submitter</th>
35             <th>received</th>
36             <th>submitted</th>
37             <th>status</th>
38             <th>srvresponse</th>
39           </tr>
40         </thead>
41         <tbody>
42           <?php
43           $stmt = $GLOBALS['db']->query($query);
44           while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
45           ?>
46             <tr class="score-<?php echo $row['status']; ?>">
47               <td><?php echo $row['fid']; ?></td>
48               <td><?php echo $row['flag']; ?></td>
49               <td><?php echo $row['service']; ?>&nbsp;</td>
50               <td><?php echo $row['flag_id']; ?>&nbsp;</td>
51               <td><?php echo $row['submitter']; ?>&nbsp;</td>
52               <td><?php echo $row['received']; ?></td>
53               <td><?php echo $row['submitted']; ?>&nbsp;</td>
54               <td><?php echo $row['status']; ?></td>
55               <td><?php echo htmlentities($row['srvresponse']); ?>&nbsp;</td>
56             </tr>
57             <?php
58           }
59           ?>
60         </tbody>
61       </table>
62     <p>Status: 0=submission pending; 1=submitted:OK; 2=submitted:Fail</p>
63     </body>
64     </html>