-
Notifications
You must be signed in to change notification settings - Fork 0
/
getComment.php
96 lines (82 loc) · 2.1 KB
/
getComment.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
89
90
91
92
93
94
95
96
<?php
// get live bid amount
error_reporting(E_ALL ^ E_WARNING);
include "connect.php";
ob_start();
session_start();
$username = $_SESSION['username'];
$session = $_SESSION['session'];
$currp = $username;
// get user information
$sql = "SELECT * FROM accounts WHERE user='$username'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
$email = $row['email'];
$hs = $row['hs'];
}
}
// get the second player
$sql = "SELECT * FROM rooms WHERE session='$session'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
$opp = $row['user'];
$room = $row['name'];
}
}
// get second user info
$sql = "SELECT * FROM accounts WHERE user='$opp'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
$emailo = $row['email'];
$hso = $row['hs'];
}
}
// start by creating a session if not already there
// insert into table if not there
$sql = "SELECT * FROM game_data_mult WHERE session='$session'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
// do nothing
while($row = mysqli_fetch_assoc($result)){
$turn = $row['turn'];
}
}else{
// creating session
$turn = 1;
$sql = "INSERT INTO game_data_mult (session,turn,room,po) VALUES ('$session','$turn','$room','$currp')";
if(mysqli_query($conn,$sql)){
header("Refresh:0");
}
}
// get the information
$sql = "SELECT * FROM game_data_mult WHERE session='$session' AND turn='$turn'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
$por = $row['por'];
$ptr = $row['ptr'];
$cba = $row['cba'];
$cbq = $row['cbq'];
$wh = $row['WH'];
$whoWon = $row['whoWon'];
$pows = $row['pows'];
$ptws = $row['ptws'];
$port = $row['port'];
$ptrt = $row['ptrt'];
$rtime = $row['rtimeo'];
$rtime2 = $row['rtimet'];
$frtime = $row['frtime'];
$frtime2 = $row['frtime2'];
$req = $row['reqt'];
$pt = $row['pt'];
$po = $row['po'];
}
}
// now we go
// get
// decide who plays
echo $wh;
?>