-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
46 lines (31 loc) · 1016 Bytes
/
Copy pathtest.php
File metadata and controls
46 lines (31 loc) · 1016 Bytes
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
<?php
include "newcon.php";
if (isset($_GET["accept"])){
$id=$_GET["accept"];
$sql = "SELECT * FROM tournaments where id=$id";
$result = $conn-> query($sql);
if($result){
foreach($result as $row){
$ton=$row['name'];
}
}
$conn = new mysqli('localhost','root','','user-verification');
$ps=$_SESSION['username'];
$sql = "SELECT * FROM $ton WHERE player='$ps' LIMIT 1";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
echo "you are already registered";
}
else{
$stmt = $conn->prepare("INSERT into $ton(player)values(?)") or die($conn->error);
$ps=$_SESSION['username'];
$stmt->bind_param("s",$ps);
$stmt->execute();
if($stmt->error){
echo "\r\nMYSQL Error: ", $stmt->error, "\r\n";}
header("location: index.php?tournamentregistration=sucess");
$stmt->close();
$conn->close();
}
}
?>