-
Notifications
You must be signed in to change notification settings - Fork 0
/
FriendList.php
245 lines (196 loc) · 11.2 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
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
<?php
include("dbconfig.php");
include("friending_functions.php");
#require_once('common_navbar.html');
ini_set('display_errors', 1);
session_start();
if (isset($_SESSION['login_user'])) {
$user_email = $_SESSION['login_user'];
} else {
$user_email = "error";
}
$user_accountID = mysqli_fetch_assoc(search_by_email($user_email,$conn))['accountID'];
$friend_list = load_friend_list($user_accountID, $conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Social Media</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
/* Add a gray background color and some padding to the footer */
footer {
background-color: #f2f2f2;
padding: 25px;
}
.carousel-inner img {
width: 100%; /* Set width to 100% */
min-height: 200px;
}
/* Hide the carousel text when the screen is less than 600 pixels wide */
@media (max-width: 600px) {
.carousel-caption {
display: none;
}
}
</style>
</head>
<body>
<!--the common nav bar-->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand"><span class="glyphicon glyphicon-apple"></span></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li id="profile_header"><a href="welcome.php">Profile</a></li>
<li id="friendList_header"><a href="FriendList.php">Friend list</a></li>
<li id="friendInvitation_header"><a href="friend_invitation.php">Friend invitation</a></li>
<li id="selectedFriends_header"><a href="select_friends.php">Create friend circle</a></li>
<li id="chatRoom_header"><a href="chat_room.php">Chat room</a></li>
<li id="chatRoom_header"><a href="blog.php">Blog</a></li>
<li id="chatRoom_header"><a href="allCollections.php">Photo Collections</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="logout.php"><span class="glyphicon glyphicon-log-in"></span> Log out</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h3> Your friends:</h3>
<br>
<div class="row">
<div class="col-sm-3">
<?php
if ($friend_list->num_rows == 0) { ?>
<img src="image1.jpeg" class="img-responsive" style="width:100%" alt="Image"> <br> <?php echo "No friends yet. Go get some friends!";
} else {
while ($row = mysqli_fetch_assoc($friend_list)) {
$friend_accountID = $row['accountID'];
$privacy_setting = check_privacy_status($friend_accountID, $conn);
?>
<img src="image5.png" style="width:80%" alt="Image">
<p><?php
if ($privacy_setting != "private") {
echo "<br>Name: " . $row['name'] . "<br>Email address: " . $row['email_address'] . "<br>Age: " . $row['age'] . "<br>Self_introduction: " . $row['self_introduction'] . "<br>City: " . $row['city'] . "<br>Country: " . $row['country'];
?></p>
<ul class="nav navbar-nav">
<li><a href="allCollections.php?accountID=<?php echo $row['accountID'] ?>">Photos</a></li>
<li class="active"><a href="blog.php?accountID=<?php echo $row['accountID'] ?>">Blog</a></li>
</ul>
<?php
} else {
echo "<br>Name: " . $row['name'] . "<br>City: " . $row['city'];
?></p>
<ul class="nav navbar-nav">
<li><a href="allCollections.php?accountID=<?php echo $row['accountID'] ?>">Photos</a></li>
</ul>
<?php } ?>
<form action="friending_backend.php" method="post" style="text-align: right;">
<input type="submit" class = "btn btn-warning" name="select" value="remove" />
<input name="b" type="hidden" id="b" value= "<?php
echo $row['accountID'];
?>" />
</form>
<br>
<br>
<?php } } ?>
</div>
<div class="col-sm-5">
</div>
<div class="col-sm-4">
<h4>Searching for a friend:</h4>
<br>
<div class="row">
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-4">
<p>Name:
<input type="text" name = "name" class="form-control" placeholder="Jacky" aria-describedby="basic-addon1" > </p>
</div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div></form>
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-4">
<p>age:
<input type="number" name = "age" class="form-control" placeholder="25" aria-describedby="basic-addon1"> </p>
</div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div></div></form>
<div class="row">
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-4">
<p>City:
<input type="text" name = "city" class="form-control" placeholder="london" aria-describedby="basic-addon1" > </p>
</div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div></form>
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-4">
<p>Country:
<input type="text" name = "friend" class="form-control" placeholder="U.K." aria-describedby="basic-addon1"> </p>
</div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div>
</form>
</div>
<div class="row">
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-10">
<p>Email address:
<input type="text" name = "email" class="form-control" placeholder="[email protected]" aria-describedby="basic-addon1"> </p>
</div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div>
</form>
</div>
<div class="row">
<form action="Searching_for_friends.php" method = "post">
<div class="col-sm-10">
<p>Friends of a known friend: <br>
<?php
$r_friend_list = load_friend_list($user_accountID, $conn);
$select = '<select name="friend_of_f">';
while ($row = mysqli_fetch_assoc($r_friend_list)) {
$friend_accountID = $row['accountID'];
$privacy_setting = check_privacy_status($friend_accountID, $conn);
if ($privacy_setting != "private") {
$select.='<option value="'.$row['accountID'].'">'.$row['name'].'</option>';
} }
$select.='</select>';
echo $select;?>
</p></div>
<div class="col-sm-2">
<br>
<input type="submit" class = "btn btn-info" name="select" value="Go" />
</div>
</form>
</div>
<br>
</div>
<hr>
</div></div>
<br>
<?php require_once('common_footer.html');?>
</body>
</html>