-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgamereq.php
More file actions
87 lines (65 loc) · 1.95 KB
/
gamereq.php
File metadata and controls
87 lines (65 loc) · 1.95 KB
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
<?php
session_start();
if($_SERVER['REQUEST_METHOD'] == "POST"){
if(empty($_POST['name']) ){
include('gamesreqform.php');
exit();
}
else if(empty($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
include('gamesreqform.php');
exit();
}
/*else if(empty($_POST["form"])) {
include('gamesreqform.php');
exit();
}
else if(empty($_POST["mob"])) {
include('gamesreqform.php');
exit();
}
else if(empty($_POST["price"])) {
include('gamesreqform.php');
exit();
}
else if(empty($_POST["type"])) {
include('gamesreqform.php');
exit();
}
else if(empty($_POST["cond"])) {
include('gamesreqform.php');
exit();
} */
else {
$id=$_SESSION['userid'];
$name=$_POST['name'];
$form=$_POST['form'];
$email=$_POST['email'];
$mob=$_POST['mob'];
$imgpath=$_POST['imgpath'];
$cond=$_POST['cond'];
$type=$_POST['type'];
$price=$_POST['price'];
$email=$_POST['email'];
$imgpath=$_POST['imgpath'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "eztrade";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO games (name,type,userid,price,cond,form,email,imgpath,phone)
VALUES ('$name','$type','$id',$price,'$cond','$form','$email','$imgpath',$mob)";
if ($conn->query($sql) === TRUE) {
$_SESSION['uniqueGame']=$name;
header('Location: afteradgame.php');
} else {
echo "Error: Record already exists" . $sql . "<br>" . $conn->error;
}
$conn->close();
}
}
?>