-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhome2.php
268 lines (212 loc) · 8.72 KB
/
home2.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
258
259
260
261
262
263
264
265
266
267
268
<?php
include_once("checkUserLoginStatus.php");
?>
<?php
// <------- by default below code display only uploded images -- need to sho oly recently uploaded----->
$imageList = "";
$select_path="SELECT * FROM images ";
$var = mysqli_query($connect_db,$select_path);
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100>";
}
// <--------below code displays recently uploded images---------->
if(isset($_GET['filter']) && $_GET['filter']=="uplod") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images ";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <--------below code displays most liked images---------->
if(isset($_GET['filter']) && $_GET['filter']=="liked")
{
$select_path = "SELECT images.image FROM images JOIN like_dislike ON images.id=like_dislike.imageId WHERE imageId>= 3";
$var=mysqli_query($connect_db,$select_path);
$sql_num_rows = mysqli_num_rows($var);
if($sql_num_rows>0) {
}
$imageList = "";
while($row=mysqli_fetch_array($var))
{
// $image_name=$row["name"];
$image_path=$row["image"];
// $image_id = $row["imageId"];
$imageList .= "<img src=".$image_path." height=100>";
}
}
//<--------below code dispays top uploded images--->
// writecode
// <----- below code is to display education category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="education") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Education'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display interior category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="interior") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Interior'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display architecture category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="architec") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Architecture'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display adventure category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="adventure") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Adventure'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display nature category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="nature") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Nature'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display technology category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="tech") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Technology'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display monuments category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="monuments") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Monuments'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
// <----- below code is to display photography category uploads--->
if(isset($_GET['filter']) && $_GET['filter']=="photography") {
// 1)WRITE IMAGE FETCH QUERY HERE
$select_path="SELECT * FROM images WHERE imageCategory='Photgraphy'";
$var=mysqli_query($connect_db,$select_path);
// 2)STORE IMAGES IN A VARIABLE USING LOOP
$imageList = "";
while($row=mysqli_fetch_array($var))
{
$image_name=$row["name"];
$image_path=$row["image"];
$image_id = $row["id"];
$imageList .= "<img src=".$image_path." height=100><br>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link href="style.css"> -->
<!-- <link rel="stylesheet" type="text/css" href="style.css"> -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<a href="smcedit.php"><button>login</button><br><br></a>
<select name="forma" onchange="location = this.options[this.selectedIndex].value;">
<option value="index.php">Free Upload</option>
<option value="index.php">Sell Ypur Photo</option>
</select>
<a href="http://localhost/SellMyClick/main_page.php?&filter=uplod"><button>recently Uploaded Images</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=liked"><button>Most Liked images</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=topup"><button>Top Uploaded Images</button></a><br><br>
<!-- TODO: REMOVE ONCLICK EVENTS -->
<!-- <div class="display-uploaded-images">dd</div> -->
<div class="display-uploaded-images">
<?php echo $imageList; ?>
</div>
<a href="view_more.php">view more </a>
<h1>select catogories to view images</h1>
<a href="http://localhost/SellMyClick/main_page.php?&filter=education"><button>Education</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=nature"><button>Nature</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=monuments"><button>Monuments</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=photography"><button>Photograpy</button></a><br><br>
<a href="http://localhost/SellMyClick/main_page.php?&filter=tech"><button>technology</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=interior"><button>Interior</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=adventure"><button>Adventure</button></a>
<a href="http://localhost/SellMyClick/main_page.php?&filter=architec"><button>Architecture</button></a><br>
<!-- scripts -->
<?php include_once("script.php"); ?>
<script>
</script>
</body>
</html>