-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhousie_functions.php
88 lines (66 loc) · 1.86 KB
/
housie_functions.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php include "access_check.php"; ?>
<?php
include "connect.php";
if($_GET['type'] == 'r')
{
$player_id = $_GET['player_id'];
mysqli_query($conn,"update players set status=1 where player_id = '$player_id';");
$result=mysqli_query($conn,"SELECT tid FROM players where player_id = '$player_id';");
$ticket=mysqli_fetch_row($result);
$_SESSION['tid']=$ticket[0];
}
if($_GET['type'] == 'c')
{
$tkt_no = $_GET['tkt_no'];
$gid = $_GET['gid'];
$result=mysqli_query($conn,"SELECT * FROM housie_current where gid= $gid and number = $tkt_no;");
if(mysqli_num_rows($result) > 0)
{
echo "<span id='ticked2'>$tkt_no</span>";
}
else
{
echo $tkt_no;
}
}
if($_GET['type'] == 'd')
{
$player_id = $_GET['player_id'];
mysqli_query($conn, "delete from players where player_id = '$player_id'");
echo "Deleted Player Successfully!";
}
if($_GET['type'] == 'a')
{
$player_id = $_GET['player_id'];
$player_name = $_GET['player_name'];
$result=mysqli_query($conn,"SELECT player_id FROM players where player_id = '$player_id';");
if(mysqli_num_rows($result) > 0)
{
echo "<font color='red'>Player NOT Added! Player ID already exists!</font>";
}
else
{
mysqli_query($conn, "insert into players values ($player_id, '$player_name')");
echo "Player Added Successfully!";
}
}
if($_GET['type'] == 's')
{
$cnt = $_GET['cnt'];
$round=mysqli_query($conn,"SELECT max(round_id) FROM play;");
$rmax=mysqli_fetch_row($round);
$round_max=$rmax[0]+1;
for($i=1;$i<=$cnt;$i++)
{
$str="player".$i;
$score=$_GET[$str];
mysqli_query($conn, "insert into play (round_id,player_id,score) values ($round_max, $i, $score)");
}
echo "Scores Added for Round $round_max Successfully!";
}
if($_GET['type'] == 'del')
{
mysqli_query($conn, "delete from play");
echo "Deleted Score Board Successfully!";
}
?>