forked from babasahi/MarocPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshoping_page.php
187 lines (131 loc) · 4.85 KB
/
shoping_page.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
include("db_connection.php");
session_start();
if (isset($_SESSION['IsLogedIn']) && $_SESSION['IsLogedIn'] == true) {
} else {
header("location:LoginPage.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Shoping Page</title>
<script type="text/javascript">
var slideIndex = 1;
showSlides(slideIndex);
// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
}
// Thumbnail image controls
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = slides.length
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
}
</script>
<link rel="stylesheet" href="shoping_page.css">
</head>
<body>
<div class="header">
<p class="logo"> Maroc PC </p>
</div>
<div style="height: 800px; width: 1300px; display: block;">
<div class="slideshow-container">
<form action="ShopingPage.php" method="post">
<div class="mySlides fade">
<div class="numbertext">1 / 3</div>
<img src="/MarocPC/Images/sampleMonitor.jpg" style="width:100%">
<input class="buyButton" type="submit" name="buyButton1" value="Acheter">
<div class="text">
<p style="color:white;">LG 27GN950-B</p>
</div>
</div>
<div class="mySlides fade">
<div class="numbertext">2 / 3</div>
<img src="/MarocPC/Images/samplePC.png" style="width:100%">
<input class="buyButton" type="submit" name="buyButton2" value="Acheter">
<div class="text">
<p> CyberPowerPC Gamer Extreme VR</p>
</div>
</div>
<div class="mySlides fade">
<div class="numbertext">3 / 3</div>
<img src="/MarocPC/Images/samplePrinter.jpeg" style="width:100%">
<input class="buyButton" type="submit" name="buyButton3" value="Acheter">
<div class="text">
<p> HP DeskJet Plus 4120</p>
</div>
</form>
<?php
if (isset($_POST['buyButton1'])) {
$myQuery = "SELECT * FROM produits WHERE nom_produit ='LG 27GN950-B' LIMIT 1 ;";
$result = mysqli_query($link, $myQuery);
if ($result && mysqli_num_rows($result) > 0) {
$data = mysqli_fetch_assoc($result);
$_SESSION['ItemPrice'] = $data['prix_produit'];
$_SESSION['ItemId'] = $data['id_produit'];
$_SESSION['ItemInventaire'] = $data['invenatire_produit'];
}
$_SESSION['ItemToBuy'] = "LG 27GN950-B";
header("location:ordering_page.php");
}
if (isset($_POST['buyButton2'])) {
$myQuery = "SELECT * FROM produits WHERE nom_produit ='CyberPowerPC Gamer Extreme VR' LIMIT 1 ;";
$result = mysqli_query($link, $myQuery);
if ($result && mysqli_num_rows($result) > 0) {
$data = mysqli_fetch_assoc($result);
$_SESSION['ItemPrice'] = $data['prix_produit'];
}
$_SESSION['ItemToBuy'] = "CyberPowerPC Gamer Extreme VR";
header("location:ordering_page.php");
}
if (isset($_POST['buyButton3'])) {
$myQuery = "SELECT * FROM produits WHERE nom_produit ='HP DeskJet Plus 4120' LIMIT 1 ;";
$result = mysqli_query($link, $myQuery);
if ($result && mysqli_num_rows($result) > 0) {
$data = mysqli_fetch_assoc($result);
$_SESSION['ItemPrice'] = $data['prix_produit'];
}
$_SESSION['ItemToBuy'] = "HP DeskJet Plus 4120";
header("location:orderin_page.php");
}
?>
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<br>
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</div>
<div class="contactUs">
<p style="font-size: 40px;">Contact Us</p>
<p>Email : conatctmarocpc@gmail.com <br>
Adresse : Route d Eljadida, KM 7, CASABLANCA, Maroc <br>
Télephone : 212 522 231 560/565 <br>
Fax : 212 522 252 245 <br>
</p>
</div>
</body>
</html>