-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
39 lines (35 loc) · 1.73 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
<?php
if(!isset($_COOKIE['user']) || !isset($_COOKIE['email'])){
header('Location:index.php');
}else{
require 'db.php';
?>
<?php
$search=trim($_POST['search']);
if(empty($search)){
echo "";
}else{
$sql="SELECT * FROM artiste_info WHERE username LIKE '%$search%'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
while($row=mysqli_fetch_assoc($result)){
if($row['profile_pic']=='' && $row['username']!=$_COOKIE['user']){
echo "<a href='info.php?id=".base64_encode($row['username'])."'><li id='not-list'><img src='profilepic/default.jpg' id='not-profile-image' ><p style='font-weight:400; margin-top:4px; padding:2px 2px; word-wrap:break-word;'>".$row['username']."</p></li></a><br />";
}elseif($row['profile_pic']!='' && $row['username']!=$_COOKIE['user']){
echo "<a href='info.php?id=".base64_encode($row['username'])."'><li id='not-list'><img src='profilepic/".$row['profile_pic']."' id='not-profile-image' ><p style='font-weight:400; margin-top:4px; padding:2px 2px; word-wrap:break-word;'>".$row['username']."</p></li></a><br />";
}
elseif($row['profile_pic']=='' && $row['username']==$_COOKIE['user']){
echo "<a href='profile.php'><li id='not-list'><img src='profilepic/default.jpg' id='not-profile-image' ><p style='font-weight:400; margin-top:4px; padding:2px 2px; word-wrap:break-word;'>".$row['username']."</p></li></a><br />";
}else{
echo "<a href='profile.php'><li id='not-list'><img src='profilepic/".$row['profile_pic']."' id='not-profile-image' ><p style='font-weight:400; margin-top:4px; padding:2px 2px; word-wrap:break-word;'>".$row['username']."</p></li></a><br />";
}
}
}else{
echo "There are no results matching your search";
}
}
?>
<?php
}
mysqli_close($conn);
?>