-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
257 lines (247 loc) · 12.7 KB
/
index.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<!--Header-->
<?php
include 'inc/functions.php';
secure_session_start();
include 'inc/head.inc.php';
include 'templates/HTMLGenerator.php'
?>
<!--MAIN-->
<main>
<div class='container'>
<header class="container-fluid jumbotron text-center">
<h1>Shawpify</h1>
<?php
if(isset($_SESSION['username'])){
echo '<p>Welcome back, '.$_SESSION['username'].'!</p>';
}
else {
echo '<p>Offering a wide range of products from consumer electronics to cars</p>';
}
?>
</header>
<div class='row'>
<div class='col-md-3'>
<p class='lead'>Product Range</p>
<p>Computers</p>
<div class='list-group'>
<a href='#' class='list-group-item'>Category 1</a>
<a href='#' class='list-group-item'>Category 2</a>
<a href='#' class='list-group-item'>Category 3</a>
</div>
<p>Cars</p>
<div class='list-group'>
<a href='#' class='list-group-item'>Category 4</a>
<a href='#' class='list-group-item'>Category 5</a>
<a href='#' class='list-group-item'>Category 6</a>
</div>
</div>
<div class='col-md-9'>
<div class='row carousel-holder'>
<div class='col-md-12'> <!--FIX: NOT class='carousel-slide'-->
<div id='carousel' class='carousel slide' data-ride='carousel'>
<ol class='carousel-indicators'>
<li data-target='#carousel' data-slide-to='0' class='active'></li>
<li data-target='#carousel' data-slide-to='1'></li>
<li data-target='#carousel' data-slide-to='2'></li>
</ol>
<div class='carousel-inner'>
<div class='item active'>
<img class='slide-image' src='img/car1.jpg' alt='Car 1'>
</div>
<div class='item'>
<img class='slide-image' src='img/car2.jpg' alt='Car 2'>
</div>
<div class='item'>
<img class='slide-image' src='img/car3.jpg' alt='Car 3'>
</div>
</div><!--ACTION FOR SLIDER -->
<a class='left carousel-control' href='#carousel' data-slide='prev'>
<span class='glyphicon glyphicon-chevron-left'></span>
</a>
<a class='right carousel-control' href='#carousel' data-slide='next'>
<span class='glyphicon glyphicon-chevron-right'></span>
</a>
</div>
</div>
</div>
<div class='row'>
<?php
//Create connection and query for product information
include_once "inc/config.php";
$conn = new mysqli(SERVER_NAME,USERNAME,PASSWORD, DATABASE);
if($conn->connect_error) {
die("Server connection error.");
}
$result = $conn->query("SELECT `name`,`price`,`description` FROM `products` LIMIT 6 OFFSET 9");
//load results in 2D array
$content = array();
while($row = $result->fetch_assoc()){
$content[] = $row;
}
$conn->close();
include_once "inc/template.php";
$thumbnail = new Template("product_thumbnail.html",$content);
for($i=0;$i<PRODUCT_ROWS*PRODUCT_COLUMNS;$i++){
if($i%PRODUCT_COLUMNS==0){
if($i!=0){
echo "</div><div class='row'>";
}
}
echo "<div class='col-sm-4 col-lg-4 col-md-4'>";
echo $thumbnail->output();
echo "</div>";
}
?>
<!--
<div class='col-sm-4 col-lg-4 col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$35,000</h4>
<h4><a href='#'>Product 1</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>15 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star-empty'></span>
</p>
</div>
</div>
</div>
<div class='col-sm-4 col-lg-4 col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$63,000</h4>
<h4><a href='#'>Product 2</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>67 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
</p>
</div>
</div>
</div>
<div class='col-sm-4 col-lg-4 col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$84,000</h4>
<h4><a href='#'>Product 3</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>8 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star-empty'></span>
<span class='glyphicon glyphicon-star-empty'></span>
</p>
</div>
</div>
</div>
</div>
<div class='row'>
<div class='col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$5,000</h4>
<h4><a href='#'>Product 4</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>37 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star-empty'></span>
</p>
</div>
</div>
</div>
<div class='col-sm-4 col-lg-4 col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$13,000</h4>
<h4><a href='#'>Product 5</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>107 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star-empty'></span>
<span class='glyphicon glyphicon-star-empty'></span>
<span class='glyphicon glyphicon-star-empty'></span>
<span class='glyphicon glyphicon-star-empty'></span>
</p>
</div>
</div>
</div>
<div class='col-sm-4 col-lg-4 col-md-4'>
<div class='thumbnail'>
<img src='http://placehold.it/320x150' alt='Thumbnail Image'>
<div class='caption'>
<h4 class='pull-right'>$182,000</h4>
<h4><a href='#'>Product 6</a></h4>
<p>Frondator velums, tanquam teres resistentia. Seculas crescere, tanquam placidus nixus.</p>
</div>
<div class='ratings'>
<p class='pull-right'>98 reviews</p>
<p>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star'></span>
<span class='glyphicon glyphicon-star-empty'></span>
</p>
</div>
</div>
</div>
<div class='text-center'>
<nav aria-label='Page navigation'>
<ul class='pagination'>
<li>
<a href='#' aria-label='Previous'>
<span aria-hidden='true'>«</span>
</a>
</li>
<li><a href='#'>1</a></li>
<li><a href='#'>2</a></li>
<li><a href='#'>3</a></li>
<li><a href='#'>4</a></li>
<li><a href='#'>5</a></li>
<li>
<a href='#' aria-label='Next'>
<span aria-hidden='true'>»</span>
</a>
</li>
</ul>
</nav>
</div>-->
</div>
</div>
</div>
</div>
</main>
<!--Footer Area-->
<?php
include 'inc/foot.inc.php';
?>