forked from cliffe/flawed_fortress-secgen_ctf_frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_pdf.php
54 lines (49 loc) · 1.33 KB
/
data_pdf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if(isset($_POST['token_pdf']) && isset($_POST['token_gen_team'])){
require 'fpdf181/fpdf.php';
include 'template/connection.php';
$team = $_POST['token_gen_team'];
$query = "SELECT * FROM users WHERE TEAM='$team'";
$result = mysqli_query($connection, $query);
class PDF extends FPDF{
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'R');
}
}
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',10);
$pdf->SetFillColor(204,255,255);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(180,10,'Capture The Flag Token',1,'','C',true);
$pdf->Ln(23);
$sno = 0;
while($row = mysqli_fetch_assoc($result)){
$pdf->SetFont('Arial','B',9);
$pdf->setFillColor(230,230,230);
$pdf->Cell(10,8,'S.No',1,'','C',true);
$pdf->Cell(80,8,'Team',1,'','C',true);
$pdf->Cell(90,8,'Token',1,'','C',true);
$pdf->Ln(8);
$pdf->SetFont('Arial','',9);
$sno = $sno + 1;
$pdf->Cell(10,8,$sno,1,'','C');
$pdf->Cell(80,8,$row['TEAM'],1,'','C');
$pdf->SetFillColor(204,255,255);
$pdf->Cell(90,8,$row['TOKEN'],1,'','C',true);
$pdf->SetTextColor(0,0,0);
$pdf->Ln(20);
}
ob_start();
$pdf->Output();
ob_flush();
}else{
header('location:index.php');
}
?>