-
Notifications
You must be signed in to change notification settings - Fork 2
/
products.php
219 lines (209 loc) · 8.49 KB
/
products.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<?php
session_start();
$conn = mysqli_connect("localhost", "root", "", "cashback");
if (!$conn) {
die("database server error");
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/products.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<script type="text/javascript" src="javascript/jquery.js"></script>
<script type="text/javascript" src="javascript/myscript.js"></script>
<script type="text/javascript" src="javascript/login.js"></script>
<title>Products</title>
</head>
<body>
<!-----------------------------------login--------------------------------------------------------------------->
<div class=modal>
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button type="button" class="toggle-btn" id="clicklogin">LogIn</button>
<button type="button" class="toggle-btn" id="clicksignup">Sign up</button>
</div>
<span class="cross_box"><i class="fa fa-times"></i></span>
<!-- <div class="social-icons">
<img src="fb.png" alt="facebook">
<img src="twitter.png" alt="twitter">
<img src="google.png" alt="google">
</div> -->
<form action="signin.php" id="login" class="input-group" method="post">
<input type="text" class="input-field" placeholder="Email ID" name="mail" required>
<input type="password" class="input-field" placeholder="Password" name="password" required>
<button type="submit" class="submit-btn">Log In</button>
</form>
<form action="join.php" id="signup" class="input-group" method="post" >
<input type="text" class="input-field" placeholder="Name" name="name" required>
<input type="text" class="input-field" placeholder="Email ID" name="mail" required>
<input type="password" class="input-field" placeholder="Password" name="password" required>
<button type="submit" class="submit-btn">Sign up</button>
</form>
</div>
</div>
<?php if(isset($_GET['loginfirst'])){ ?>
<div class=modal style="display:block;">
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button type="button" class="toggle-btn" id="clicklogin">LogIn</button>
<button type="button" class="toggle-btn" id="clicksignup">Sign up</button>
</div>
<span class="cross_box"><i class="fa fa-times"></i></span>
<!-- <div class="social-icons">
<img src="fb.png" alt="facebook">
<img src="twitter.png" alt="twitter">
<img src="google.png" alt="google">
</div> -->
<form action="signin.php" id="login" class="input-group" method="post">
<input type="text" class="input-field" placeholder="Email ID" name="mail" required>
<input type="password" class="input-field" placeholder="Password" name="password" required>
<button type="submit" class="submit-btn">Log In</button>
</form>
<form action="join.php" id="signup" class="input-group" method="post" >
<input type="text" class="input-field" placeholder="Name" name="name" required>
<input type="text" class="input-field" placeholder="Email ID" name="mail" required>
<input type="password" class="input-field" placeholder="Password" name="password" required>
<button type="submit" class="submit-btn">Sign up</button>
</form>
</div>
</div>
<?php } ?>
<!----------------------------------navbar---------------------------------------------------------------------->
<div class="navbar">
<div class="col-md-5 heading"><h3><a href="index.php">Earning Shop</a></h3></div>
<div class="col-md-7 links">
<div class="col-md-4"></div>
<p class="linksp">
<?php if(isset($_SESSION['name'])) { ?>
<a href="account.php?account">My Account</a>
<a href="logout.php">Signout</a>
<a href="">How it Works</a>
<?php }
else{?>
<a id="login_signup" style="cursor:pointer;">Login/Sign up</a>
<a href="">How it Works</a>
<?php } ?>
<span class="menubar"><i class="fa fa-bars" style="color:white; font-size:20px;"></i></span>
<div class="openmenu">
<ul>
<li style="text-align:center;"><a href="products.php?allproducts">All Products</a></li>
<li style="text-align:center;"><a href="products.php?alldeals">All deals</a></li>
<li style="text-align:center;"><a href="#categories">Categories</a></li>
<li style="text-align:center;"><a href="">About us</a></li>
</ul>
</div>
</p>
</div>
</div>
<div class="clearfix"></div>
<!-------------------------------------------body------------------------------------------------------------------>
<?php
if(isset($_GET['cat'])){
?>
<?php
$sql = "SELECT * FROM products WHERE category = '".$_GET['cat']."'";
$result = mysqli_query($conn, $sql);
?>
<div class="showproducts">
<?php while($row = mysqli_fetch_array($result)) { ?>
<?php if(isset($_SESSION['name'])) { ?>
<a href="<?php echo $row[5]; ?>">
<?php }
else {?>
<a href="products.php?loginfirst">
<?php } ?>
<div class="products col-md-2">
<div class="shadow">
<img src="images/products/<?php echo $row[3]; ?>" alt="img" width="100%">
<p class="nameofprod"><?php echo $row[1] ?></p>
<p class=offeronprod><?php echo $row[6]; ?></p>
</div>
</div>
</a>
</a>
<?php } ?>
</div>
<div class="clearfix"></div>
<?php
$cmd = "SELECT * FROM deals WHERE category = '".$_GET['cat']."'";
$result1 = mysqli_query($conn, $cmd);
?>
<div class="showdeals">
<h4>Deals</h4>
<hr>
<?php while($row1 = mysqli_fetch_array($result1)) { ?>
<?php if(isset($_SESSION['name'])) { ?>
<a href="<?php echo $row1[4]; ?>">
<?php }
else {?>
<a href="products.php?loginfirst">
<?php }?>
<div class="deals col-md-2">
<div class="shadow">
<img src="images/deals/<?php echo $row1[2]; ?>" alt="img">
<p class=offerondeal><?php echo $row1[3]; ?></p>
</div>
</div>
</a>
</a>
<?php }
} ?>
</div>
<!--------------------------------------All products and deals--------------------------------------------------------->
<?php
if(isset($_GET['allproducts'])) {
$products = "SELECT * FROM products";
$result_products = mysqli_query($conn, $products);
?>
<div class="allproducts">
<?php while($rowproducts = mysqli_fetch_array($result_products)) { ?>
<?php if(isset($_SESSION['name'])) { ?>
<a href="<?php echo $rowproducts[5] ?>">
<?php }
else {?>
<a href="products.php?loginfirst">
<?php } ?>
<div class="showallproducts col-md-2">
<div class="shadow">
<img src="images/products/<?php echo $rowproducts['3'];?>" alt="img">
<p class="nameofprod"><?php echo $rowproducts[1]; ?></p>
<p class="offeronprod"><?php echo $rowproducts[6]; ?></p>
</div>
</div>
</a>
</a>
<?php } ?>
</div>
<?php }
if(isset($_GET['alldeals'])) {
$deals = "SELECT * FROM deals";
$result_deals = mysqli_query($conn, $deals);
?>
<div class="allproducts">
<?php while($rowdeals = mysqli_fetch_array($result_deals)) { ?>
<?php if(isset($_SESSION['name'])) { ?>
<a href="<?php echo $rowdeals[4] ?>">
<?php }
else {?>
<a href="products.php?loginfirst">
<?php } ?>
<div class="showallproducts col-md-2">
<div class="shadow">
<img src="images/deals/<?php echo $rowdeals['2'];?>" alt="img" style="width:100%;">
<p class="nameofprod" style="font-size:18px;"><?php echo $rowdeals['1'] ?></p>
<p class="offerondeal"><?php echo $rowdeals[3]; ?></p>
</div>
</div>
</a>
</a>
<?php } ?>
</div>
<?php } ?>
</body>
</html>