]> git.somenet.org - ctf/pub/submit_bot.git/blob - index.php
adapted to esse-CTF
[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 by Jan "Someone" Vales <someone@somenet.org>
9 * do not publish!
10 */
11
12 $GLOBALS['db'] = new PDO('pgsql:host=localhost;port=5432;dbname=postgres;user=postgres;password=dba');                                                                                                              
13 $GLOBALS['db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);                                                                                            
14 $query = "SELECT * FROM flags WHERE (received + INTERVAL '30 minute') > now() and char_length(flag) = 32 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</h1>
24     <p>Shows all submissions of the last 30 min<br>
25     NUM ROWS: <?php echo sizeof($GLOBALS['db']->query($query)->fetchAll()); ?></p>
26     <table style="width: 100%">
27       <thead>
28         <tr>
29             <th>fid</th>
30             <th>flag</th>
31             <th>service</th>
32             <th>received</th>
33             <th>submitted</th>
34             <th>status</th>
35             <th>srvresponse</th>
36           </tr>
37         </thead>
38         <tbody>
39           <?php
40           $stmt = $GLOBALS['db']->query($query);
41           while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
42           ?>
43             <tr class="score-<?php echo $row['status']; ?>">
44               <td><?php echo $row['fid']; ?></td>
45               <td><?php echo $row['flag']; ?></td>
46               <td><?php echo $row['service']; ?>&nbsp;</td>
47               <td><?php echo $row['received']; ?></td>
48               <td><?php echo $row['submitted']; ?>&nbsp;</td>
49               <td><?php echo $row['status']; ?></td>
50               <td><?php echo htmlentities($row['srvresponse']); ?>&nbsp;</td>
51             </tr>
52             <?php
53           }
54           ?>
55         </tbody>
56       </table>
57     </body>
58     </html>