-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZappos_database.php
More file actions
64 lines (43 loc) · 1.36 KB
/
Copy pathZappos_database.php
File metadata and controls
64 lines (43 loc) · 1.36 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
<?php
if (!empty($_POST))
{
$url= "http://api.zappos.com/Product/".$_POST['productid']."?includes=[%22styles%22]&key=a73121520492f88dc3d33daf2103d7574f1a3166";
$response = @file_get_contents($url);
if($response===false)
{
echo "This product is not valid ! Check your product ID!";
}
else
{
// echo $response;
$con=mysqli_connect("localhost","gplusbus","Akshar11!!","gplusbusDeals");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO Zappos_users (Email, Product_ID)
VALUES
('$_POST[email]','$_POST[productid]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "Your preference has been saved ! You will receive a notification if product have 20 % off !";
mysqli_close($con);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Database connect !</title>
</head>
<body>
<form action="Zappos_Database.php" method="post"><br>
Email: <input type="text" name="email"><br></br>
product name: <input type="text" name="productid">
<input type="submit">
</form>
</body>
</html>