-
Notifications
You must be signed in to change notification settings - Fork 3
/
FriendList.php
169 lines (150 loc) · 5.15 KB
/
FriendList.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
<!-- Fahimul Hoque Shubho -->
<?php
session_start();
$con=mysqli_connect("localhost","digibd_docket","docket","digibd_docket");
//$con=mysqli_connect("localhost","root","","docket");
if($con===false)
{
echo '<script type= "text/javascript"> alert ("Database Could not connect")</script>';
}
$loggedIn = $_SESSION['loggedIn'];
if($loggedIn != 1)
{
echo '<script type="text/javascript"> alert ("Please sign in first")</script>';
echo "<script> location.href='SignIn.php'; </script>";
}
else
{
$userID = $_SESSION['userID'];
unset($_SESSION['db']);
$db = $userID.'_Friends';
?>
<!DOCTYPE html>
<head>
<title>Friends</title>
<link rel='icon' href='favicon.png' type='image/x-icon'/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Dosis:400,700,500|Nunito:300,400,600' />
<link rel="stylesheet" href="css/plugins.css">
<link rel="stylesheet" href="css/style_shubho.css">
</head>
<body>
<div id="preloader">
<img class="logo" src="images/logo_1.png" alt="Center" >
<div id="status">
<span></span>
<span></span>
</div>
</div>
<header class="ht-header">
<div class="container">
<nav class="navbar navbar-default navbar-custom">
<div class="navbar-header logo">
<div class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only"></span>
<div id="nav-icon1">
<span></span>
<span></span>
<span></span>
</div>
</div>
<a href="UserProfile.html"><img class="logo" src="images/logo_1.png" alt="" width="150" height="60"></a>
</div>
<div class="collapse navbar-collapse flex-parent" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav flex-child-menu menu-left">
<li><a href="Anime.php"><h4>Anime</h4></a></li>
<li><a href="movie.html"><h4> Movies </h4></a></li>
<li><a href="TvSeries.php"><h4> Tv-Series </h4></a></li>
<li><a href="games.html"><h4> Games </h4></a></li>
<li><a href="Books.php"><h4> Books </h4></a></li>
<li><a href="blogList.html"><h4>Blogs </h4></a></li>
</ul>
<ul class="nav navbar-nav flex-child-menu menu-right">
<li><a href="search.php"><img class="logo" src="images/search.png" alt="" width="50" height="50"></a></li>
<div class="" title="Go to Profile">
<li><a href="UserProfile.php"><img class="logo" src="images/profile.png" alt="" width="78" height=""></a></li>
</div>
</ul>
</div>
</nav>
</header>
<div class="hero user-heroFriend">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="hero-ctFriends">
<img class="logo" src="images/friendList.png" alt="" width="50" height="">
<h1>Friends</h1>
</div>
</div>
</div>
</div>
</div>
<!-- search for friend or user -->
<form class="search_db" action="UserSearch.php" style="margin:auto;max-width:500px">
<input type="text" placeholder="Search for a Friend or User" name="searchUser">
<button type="submit"><i class="fa fa-search"></i></button>
</form>
<div class="buster-light">
<div class="page-single">
<div class="container">
<div class="flex-wrap-friendlist">
<?php
$sql = "SELECT friendName, friendId, profilePic FROM {$db}";
$query= mysqli_query($con,$sql);
if(mysqli_num_rows($query) > 0 )
{
$count=mysqli_num_rows($query);
$name = array();
$pic = array();
$id = array();
while($info = mysqli_fetch_array($query))
{
$name[] = $info['friendName'];
$pic[] = $info['profilePic'];
$id[] = $info['friendId'];
}
//print_r($watchList);
for($i=0; $i < $count; $i++)
{
?>
<div class="friend-item-style-2 friend-item-style-1">
<a href=<?php echo "FriendProifile.php?friendId=$id[$i]"?>>
<img src=<?php echo $pic[$i] ?> alt="" width="200">
<?php echo "<h6> $name[$i] </h6>"; ?>
</a>
</div>
<?php
}
}
else
{
?>
<div class="friend-item-style-2 friend-item-style-1">
<img src='images/empty.jpg' alt="">
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<script>
for(var els = document.getElementsByTagName('a'), i = els.length; i--;){
var href = els[i].href;
els[i].href = 'javascript:void(0);';
els[i].onclick = (function(el, href){
return function(){
window.location.href = href;
};
})(els[i], href);
}
</script>
<script src="js/jquery.js"></script>
<script src="js/plugins.js"></script>
<script src="js/plugins2.js"></script>
<script src="js/custom.js"></script>
</body>
</html>
<?php } ?>