Skip to content

Commit d8cb4f1

Browse files
committed
Admin Account System Status Option
1 parent d74c2dc commit d8cb4f1

File tree

2 files changed

+194
-7
lines changed

2 files changed

+194
-7
lines changed

admin.php

Lines changed: 180 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<a href="admin.php?option=announce"><span>ANNOUNCE</span></a>
3636
<a href="admin.php?option=import-secgen"><span>IMPORT SECGEN</span></a>
3737
<a href="admin.php?option=db-manage"><span>DATABASE MANAGEMENT</span></a>
38+
<a href="admin.php?option=verify"><span>SYSTEM STATUS</span></a>
3839
<a href="template/logout.php"><span>LOGOUT</span></a>
3940
</div>
4041
<div id="content">
@@ -275,7 +276,10 @@
275276
$team_mem_code = $team_members_row['TEAM'];
276277
$team_members_list = mysqli_query($connection, "SELECT USERNAME,TOKEN,TOKEN_ACT FROM users WHERE TEAM='$team_mem_code' AND TYPE='N'");
277278
$count_members = mysqli_num_rows($team_members_list);
278-
echo "<td rowspan='$count_members'>$team_mem_code</td>";
279+
$team_name_getter_new = mysqli_query($connection, "SELECT TEAMNAME FROM team WHERE TEAM='$team_mem_code'");
280+
while($team_name_getter_row = mysqli_fetch_assoc($team_name_getter_new)){
281+
echo "<td rowspan='$count_members'>".$team_name_getter_row['TEAMNAME']."</td>";
282+
}
279283
while($team_members_list_row = mysqli_fetch_assoc($team_members_list)){
280284
$username = $team_members_list_row['USERNAME'];
281285
$token = $team_members_list_row['TOKEN'];
@@ -1123,6 +1127,181 @@
11231127

11241128
<?php
11251129
break;
1130+
1131+
case "verify":
1132+
?>
1133+
<div id="team1-div">
1134+
<h1>System Game Status</h1>
1135+
<table>
1136+
<tr class="table_heading">
1137+
<th>Name</th>
1138+
<th>Status</th>
1139+
</tr>
1140+
<tr>
1141+
<td>Any Token Conflict</td>
1142+
1143+
<?php
1144+
$q1 = mysqli_query($connection, "SELECT TOKEN FROM users group by TOKEN having count(*) >= 2");
1145+
$q1_result = mysqli_num_rows($q1);
1146+
if($q1_result == 0){
1147+
echo "<td style='background:#c3e29c;color:black;text-align:center;'>No Conflict</td>";
1148+
}else{
1149+
while($row1 = mysqli_fetch_assoc($q1)){
1150+
$q1_b = $row1['TOKEN'];
1151+
echo "<td style='background:#f7b9b9;color:black;text-align:center;'>$q1_b</td>";
1152+
}
1153+
}
1154+
1155+
?>
1156+
1157+
</tr>
1158+
<tr>
1159+
<td>Any Notification Conflict</td>
1160+
1161+
<?php
1162+
$q2 = mysqli_query($connection, "SELECT USERNAME FROM users WHERE TOKEN_ACT='1' AND TYPE='N'");
1163+
$q22 = mysqli_query($connection, "SELECT USERNAME FROM updater");
1164+
$q2_result = mysqli_num_rows($q2);
1165+
$q22_result = mysqli_num_rows($q22);
1166+
if($q2_result == $q22_result){
1167+
echo "<td style='background:#c3e29c;color:black;text-align:center;'>No Conflict</td>";
1168+
}else{
1169+
echo "<td style='background:#f7b9b9;color:black;text-align:center;'>Conflict</td>";
1170+
}
1171+
1172+
?>
1173+
1174+
</tr>
1175+
<tr>
1176+
<td>Any Scoreboard & Team Conflict</td>
1177+
1178+
<?php
1179+
$q4 = mysqli_query($connection, "SELECT TEAM,TEAMNAME FROM scoreboard");
1180+
$q44 = mysqli_query($connection, "SELECT TEAM,TEAMNAME FROM team");
1181+
1182+
if(mysqli_num_rows($q4) == mysqli_num_rows($q44)){
1183+
echo "<td style='background:#c3e29c;color:black;text-align:center;'>No Conflict</td>";
1184+
}else{
1185+
$total = mysqli_num_rows($q4);
1186+
echo "<td style='background:#f7b9b9;color:black;text-align:center;'>Conflict</td>";
1187+
}
1188+
1189+
?>
1190+
1191+
</tr>
1192+
<tr>
1193+
<td>Pending Registration</td>
1194+
1195+
<?php
1196+
$q3 = mysqli_query($connection, "SELECT TOKEN_ACT FROM users WHERE TOKEN_ACT='0'");
1197+
$q3_result = mysqli_num_rows($q3);
1198+
if($q3_result == 0){
1199+
echo "<td style='background:#c3e29c;color:black;text-align:center;'>All Registered</td>";
1200+
}else{
1201+
echo "<td style='background:#f7b9b9;color:black;text-align:center;'>$q3_result </td>";
1202+
}
1203+
1204+
?>
1205+
1206+
</tr>
1207+
</table>
1208+
<h1>Table Status</h1>
1209+
<table>
1210+
<tr class="table_heading">
1211+
<th>Chat</th>
1212+
<th>Hint</th>
1213+
<th>Logger</th>
1214+
<th>Options</th>
1215+
<th>Report</th>
1216+
<th>Scoreboard</th>
1217+
<th>SecGen</th>
1218+
<th>SecGenFlag</th>
1219+
<th>Team</th>
1220+
<th>Updater</th>
1221+
<th>Users</th>
1222+
</tr>
1223+
<tr>
1224+
<?php
1225+
$tables = array("chat", "hint", "logger", "options","report","scoreboard","secgen","secgenflag","team","updater","users");
1226+
foreach($tables as $tab){
1227+
if(mysqli_num_rows(mysqli_query($connection, "SHOW TABLES LIKE '$tab'"))==0){
1228+
echo "<td style='background:#f7b9b9;color:black;text-align:center;'>Failed</td>";
1229+
}else{
1230+
echo "<td style='background:#c3e29c;color:black;text-align:center;'>Success</td>";
1231+
}
1232+
}
1233+
?>
1234+
</tr>
1235+
</table>
1236+
<h1>Challenges</h1>
1237+
<table>
1238+
<tr class="table_heading">
1239+
<th>Team</th>
1240+
<th>VM</th>
1241+
<th>Challenges</th>
1242+
<th>Hint</th>
1243+
</tr>
1244+
<?php
1245+
$select = mysqli_query($connection, "SELECT * FROM team");
1246+
while($team_row = mysqli_fetch_assoc($select)){
1247+
$team = $team_row['TEAM'];
1248+
$teamName = $team_row['TEAMNAME'];//team
1249+
$vm = mysqli_query($connection, "SELECT DISTINCT VM FROM secgenflag WHERE TEAM='$team'");
1250+
$vm_query = mysqli_num_rows($vm);//vm
1251+
$challenges = mysqli_query($connection, "SELECT C_ID FROM secgenflag WHERE TEAM='$team'");
1252+
$challenges_count = mysqli_num_rows($challenges);//challenges
1253+
$hint_q = mysqli_query($connection, "SELECT HINT_ID FROM hint WHERE TEAM='$team'");
1254+
$hint_count = mysqli_num_rows($hint_q);//hint
1255+
?>
1256+
<tr>
1257+
<td style='text-align:center;'><?php echo $teamName;?></td>
1258+
<td style='text-align:center;'><?php echo $vm_query;?></td>
1259+
<td style='text-align:center;'><?php echo $challenges_count;?></td>
1260+
<td style='text-align:center;'><?php echo $hint_count;?></td>
1261+
</tr>
1262+
1263+
<?php
1264+
}
1265+
?>
1266+
</table>
1267+
<h1>Error Monitor</h1>
1268+
<table>
1269+
<tr class="table_heading">
1270+
<th>S.No</th>
1271+
<th>Date</th>
1272+
<th>Log</th>
1273+
</tr>
1274+
<?php
1275+
$log = mysqli_query($connection, "SELECT * FROM report");
1276+
$count = mysqli_num_rows($log);
1277+
if($count > 0){
1278+
while($repo = mysqli_fetch_assoc($log)){
1279+
$id = $repo['ID'];
1280+
$date = $repo['DATE'];
1281+
$logtext = $repo['LOG'];
1282+
?>
1283+
<tr>
1284+
<td style='text-align:left;color:black;background:#f7b9b9;'><?php echo $id;?></td>
1285+
<td style='text-align:left;color:black;background:#f7b9b9;'><?php echo $date;?></td>
1286+
<td style='text-align:left;color:black;background:#f7b9b9;'><?php echo $logtext;?></td>
1287+
</tr>
1288+
1289+
<?php
1290+
}
1291+
}else{
1292+
?>
1293+
<tr>
1294+
<td style='background:#c3e29c;color:black;text-align:center;'>STATUS_OK</td>
1295+
<td style='background:#c3e29c;color:black;text-align:center;'>STATUS_OK</td>
1296+
<td style='background:#c3e29c;color:black;text-align:center;'>STATUS_OK</td>
1297+
</tr>
1298+
<?php
1299+
}
1300+
?>
1301+
</table>
1302+
</div>
1303+
<?php
1304+
break;
11261305

11271306
default:
11281307
header('location:admin.php?option=team');

data_pdf.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
require 'fpdf181/fpdf.php';
66
include 'template/connection.php';
77
$team = $_POST['token_gen_team'];
8+
$teamName = "NULL";
89
$query = "SELECT * FROM users WHERE TEAM='$team'";
910
$result = mysqli_query($connection, $query);
1011
class PDF extends FPDF{
@@ -22,30 +23,37 @@ function Footer()
2223
$pdf = new PDF();
2324
$pdf->AddPage();
2425
$pdf->SetFont('Arial','',10);
25-
$pdf->SetFillColor(204,255,255);
26+
$pdf->SetFillColor(171,209,125);
2627
$pdf->SetFont('Arial','B',9);
27-
$pdf->Cell(180,10,'Capture The Flag Token',1,'','C',true);
28+
$pdf->Cell(180,20,'Flawed Fortress Keys',1,'','C',true);
29+
$pdf->Ln(20);
30+
$pdf->SetFillColor(231,239,220);
31+
$pdf->Cell(180,10,'http://schreuders.org/flawedfortress/',1,'','C',true);
2832
$pdf->Ln(23);
2933

3034
$sno = 0;
3135
while($row = mysqli_fetch_assoc($result)){
36+
$team_name_getter_new = mysqli_query($connection, "SELECT TEAMNAME FROM team WHERE TEAM='$team'");
37+
while($team_row = mysqli_fetch_assoc($team_name_getter_new)){
38+
$teamName = $team_row['TEAMNAME'];
39+
}
3240
$pdf->SetFont('Arial','B',9);
33-
$pdf->setFillColor(230,230,230);
41+
$pdf->setFillColor(231,239,220);
3442
$pdf->Cell(10,8,'S.No',1,'','C',true);
3543
$pdf->Cell(80,8,'Team',1,'','C',true);
3644
$pdf->Cell(90,8,'Token',1,'','C',true);
3745
$pdf->Ln(8);
3846
$pdf->SetFont('Arial','',9);
3947
$sno = $sno + 1;
4048
$pdf->Cell(10,8,$sno,1,'','C');
41-
$pdf->Cell(80,8,$row['TEAM'],1,'','C');
42-
$pdf->SetFillColor(204,255,255);
49+
$pdf->Cell(80,8,$teamName,1,'','C');
50+
$pdf->SetFillColor(195,219,166);
4351
$pdf->Cell(90,8,$row['TOKEN'],1,'','C',true);
4452
$pdf->SetTextColor(0,0,0);
4553
$pdf->Ln(20);
4654
}
4755
ob_start();
48-
$pdf->Output();
56+
$pdf->Output('',$teamName);
4957
ob_flush();
5058

5159
}else{

0 commit comments

Comments
 (0)