-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathticket.php
68 lines (56 loc) · 3.26 KB
/
ticket.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php include "access_check.php"; ?>
<?php
include "connect.php";
if(isset($_GET['gid'])) { $gid=$_GET['gid']; }
if(isset($_GET['tid'])) { $tid=$_GET['tid']; }
if($tid == 0)
{
$game_res=mysqli_query($conn, "SELECT gid, DATE_FORMAT(schedule, '%W %M %e %Y') as dt, DATE_FORMAT(schedule, '%h:%i %p') as tm, status, cost FROM games where gid=$gid;");
$row=mysqli_fetch_array($game_res);
echo "<h3 align='center'>YOU HAVE NOT JOINED THIS GAME!</h3>";
echo "<div align='center'><a href='game.php?gid=$gid'><b>Game #$gid</b></a>";
echo "- $row[1] - $row[2]</div>";
$cost = $row[4]>0? $row[4]." points" : "<span style='color:yellow;'>FREE GAME</span>";
echo "<div id='gerr$gid' align='center'><button type='button' class='mb-1 mt-1 mr-1 btn btn-sd btn-primary' onclick='buy_ticket($pid,$gid);'>JOIN GAME ($cost)</button></div>";
}
else
{
include "completed.php";
$pid=$_SESSION['pid'];
$ticket=mysqli_query($conn, "SELECT * FROM tickets where ticket_id=$tid order by line;");
$ft=0;
while($line=mysqli_fetch_row($ticket))
{
echo "<tr>";
$cnt=2;
$final_ticket[$ft]=$line[2];$ft++;
$final_ticket[$ft]=$line[3];$ft++;
$final_ticket[$ft]=$line[4];$ft++;
$final_ticket[$ft]=$line[5];$ft++;
$final_ticket[$ft]=$line[6];$ft++;
$tkt_no=$line[$cnt];
if($tkt_no < 10) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt]; } else { echo "<td></td>";}
if($tkt_no >=10 && $tkt_no < 20) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=20 && $tkt_no < 30) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=30 && $tkt_no < 40) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=40 && $tkt_no < 50) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=50 && $tkt_no < 60) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=60 && $tkt_no < 70) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=70 && $tkt_no < 80) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
if($tkt_no >=80 && $tkt_no <= 90) { format_no($tkt_no,$completed,$gid); $cnt++; $tkt_no=$line[$cnt];} else { echo "<td></td>";}
echo "</tr>";
}
}
function format_no($tkt_no,$completed,$gid)
{
echo "";
if(in_array($tkt_no,$completed))
{
echo "<td id='$tkt_no' ><span id='ticked2'>$tkt_no</span></td>";
}
else
{
echo "<td id='$tkt_no' onclick='check($tkt_no,$gid);' style='cursor: pointer;'>$tkt_no</td>";
}
}
?>