-
Notifications
You must be signed in to change notification settings - Fork 4
/
search.php
214 lines (175 loc) · 7.42 KB
/
search.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
<!doctype html>
<html class="no-js" lang="zxx">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Search Page </title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="site.webmanifest">
<link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.ico">
<!-- CSS here -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/owl.carousel.min.css">
<link rel="stylesheet" href="assets/css/slicknav.css">
<link rel="stylesheet" href="assets/css/flaticon.css">
<link rel="stylesheet" href="assets/css/animate.min.css">
<link rel="stylesheet" href="assets/css/magnific-popup.css">
<link rel="stylesheet" href="assets/css/fontawesome-all.min.css">
<link rel="stylesheet" href="assets/css/themify-icons.css">
<link rel="stylesheet" href="assets/css/slick.css">
<link rel="stylesheet" href="assets/css/nice-select.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<style>
/*to remove all white space at left and right sides of screen*/
html,body
{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
/*if you enable below code it will show all marking for debugging css*/
/*{
//background: #000 !important;
//color: #0f0 !important;
//outline: solid #f00 1px !important;
//}
*/
</style>
<body class="body-bg">
<!--? Preloader Start -->
<div id="preloader-active">
<div class="preloader d-flex align-items-center justify-content-center">
<div class="preloader-inner position-relative">
<div class="preloader-circle"></div>
<div class="preloader-img pere-text">
<img src="assets/img/logo/loder.jpg" alt="">
</div>
</div>
</div>
</div>
<?php
require_once "header.php" ;
?>
<?php
require_once "loginfo.php";
//Connection
$conn = new mysqli($servername , $username , $password);
if(!$conn) {
die("[-] Connection error with MySql");
}
//first use database
$sql = "USE $product_database";
if(!mysqli_query($conn , $sql)){
die("Error while using database !!");
}
//echo $_POST['search'].'<br>';
//echo $_POST['category'].'<br>';
//take posted data from header.php
$src = $_REQUEST['search'];
//$ctg = $_POST['category'];
//first take all product from database and then show them (add link to their seperate page)
if($src != "") {
$sql = "select * from $product_table where $category like '%$src%'";
$res = mysqli_query($conn , $sql);
if(!$res) {
echo "[-] Error while querying in product database";
} else {
//while($row = mysqli_fetch_assoc($res)) {
//echo $row[$product_name].'<br>';
//}
}
}
?>
<main>
<ul>
<?php
//echo '<h5>
//Showing results for search word : "'.$src.'" in category : '.$ctg.'
//</h5>';
//show all products here
if($src!="" && mysqli_num_rows($res)>0) {
while($row = mysqli_fetch_assoc($res)) {
$image_path = $PATH.'/'.$row[$product_file].'/photos/'.$row[$mainFrame];
$product_link = 'product/'.$row[$product_file].'/'.$row[$product_id];
//access json file for another info about product
$jsonfile = $PATH.'/'.$row[$product_file].'/info.json';
$jsondata = file_get_contents($jsonfile);
$array = json_decode($jsondata , true);
echo '
<div class="container justify-content-start">
<a href='.$product_link.' style="text-decoration:none;">
<li style="border-radius: 5px; border-top: 2px solid #EBEDEE; " class="mb-3 d-flex shadow bd-highlight py-md-2 col-lg-8 offset-lg-2">
<div class="row">
<div class="container col-md-3 col-lg-2 col-4 offset-1 offset-lg-2 mb-2 mt-2 mt-md-0 mb-md-0 ">
<div class="row">
<img src='.$image_path.' class="col-12 my-3 my-md-0 my-lg-4 col-md-12 img-thumbnail">
</div>
</div>
<div class="container col-md-6 col-6 ">
<h4 class="d-none d-sm-block ">'.$row[$product_name].'</h4>
<h5 class="d-sm-none">'.$row[$product_name].'</h4>
<p>Brand : '.$array['data']['Brand'].'</p>
<span >Category : '.$row[$category].'</span>
</div>
</div>
</li>
</a>
</div>
';
}
} else {
echo "
<div class='alert alert-danger' role='alert'>
Opps ! No such product available
</div>
";
}
?>
</ul>
</main>
<?php
include("footer.html");
?>
<!-- Scroll Up -->
<div id="back-top">
<a title="Go to Top" href="#"> <i class="fas fa-level-up-alt"></i></a>
</div>
<div id="chat">
<a title="Go to Top" href="#"> <i class="fas fa-comments"></i></a>
</div>
<!-- JS here -->
<script src="./assets/js/vendor/modernizr-3.5.0.min.js "></script>
<!-- Jquery, Popper, Bootstrap -->
<script src="./assets/js/vendor/jquery-1.12.4.min.js "></script>
<script src="./assets/js/popper.min.js "></script>
<script src="./assets/js/bootstrap.min.js "></script>
<!-- Jquery Mobile Menu -->
<script src="./assets/js/jquery.slicknav.min.js "></script>
<!-- Jquery Slick , Owl-Carousel Plugins -->
<script src="./assets/js/owl.carousel.min.js "></script>
<script src="./assets/js/slick.min.js "></script>
<!-- One Page, Animated-HeadLin -->
<script src="./assets/js/wow.min.js "></script>
<script src="./assets/js/animated.headline.js "></script>
<script src="./assets/js/jquery.magnific-popup.js "></script>
<!-- Nice-select, sticky -->
<script src="./assets/js/jquery.nice-select.min.js "></script>
<script src="./assets/js/jquery.sticky.js "></script>
<!-- counter , waypoint -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js "></script>
<script src="./assets/js/jquery.counterup.min.js "></script>
<!-- contact js -->
<script src="./assets/js/contact.js "></script>
<script src="./assets/js/jquery.form.js "></script>
<script src="./assets/js/jquery.validate.min.js "></script>
<script src="./assets/js/mail-script.js "></script>
<script src="./assets/js/jquery.ajaxchimp.min.js "></script>
<!-- Jquery Plugins, main Jquery -->
<script src="./assets/js/plugins.js "></script>
<script src="./assets/js/main.js "></script>
</body>
</html>