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