-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.php
86 lines (77 loc) · 1.91 KB
/
next.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
<?php include("include/function.php");?>
<html>
<meta charset="UTF-8">
<head>
<style>
body {
background: url(Images/nk.jpg) no-repeat center center fixed #000;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: 100% 100%;
overflow: hidden;
}
</style>
</head>
</html>
<?php
$capt = $_POST["captain"];
$team = $_SESSION["teamno"];
echo $capt;
// Create connection
$conn = new mysqli(HOST, US_NAME, PASS_W, DB_NAME);
$conn->set_charset("utf8");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql1 = "SELECT * FROM list WHERE id = '$team' ";
$result1 = $conn->query($sql1);
$row1=$result1->fetch_assoc();
$sql2= 'SELECT * FROM players WHERE Name = "'.$capt.'"';
$result2 = $conn->query($sql2);
if ($result2->num_rows == 0)
{
echo "NO player exist with this name";
echo "</br>"."<a href=fourth.html>Click Here to Display team !</a>";
}
else
{
$flag=0;
$i=1;
for($i=1;$i<=15;$i++)
{
if($row1["$i"]===$capt)
{ $flag =1;
break;
}
}
if($flag===0)
{
echo "No player in this team";
echo "</br>"."<a href=fourth.html>Click Here to Display team !</a>";
}
else
{
$row2=$result2->fetch_assoc();
//$capt1= $row1["captain"];
{
//echo $row1["points"];
//echo $row2["points"];
$sql= 'UPDATE list SET captain = "'.$capt.'" WHERE id = "'.$team.'"';
if($conn->query($sql)===TRUE)
echo "New captain name: ".$capt." for team ".$team."<br>";
$count=$row1["points"]+$row2["points"];
$sql = "UPDATE list SET points = '$count' WHERE id = '$team'";
if($conn->query($sql)===TRUE)
echo "New Points:".$count;
}
//echo "</br>"."<a href=drop.html>Click Here to return to bidding!</a>";
//echo "</br>"."<a href=fourth.html>Click Here to Display team !</a>";
$conn->close();
}
}
echo'<script>
window.onload(window.open("teams.php?key='.$team.'","_self"));
</script>';
?>