-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfriends.php
More file actions
87 lines (60 loc) · 1.87 KB
/
friends.php
File metadata and controls
87 lines (60 loc) · 1.87 KB
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
<?php
session_start();
if (!isset($_SESSION['user_id']) || !isset($_SESSION['username'])) {
header('Location: login.html');
exit;
}
$user_id = $_SESSION['ID'];
$username = $_SESSION['username'];
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$email = $_SESSION['email'];
require_once "phpfunctions/getfriends.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Account</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'navbar.php'; ?>
<!-- ----profile page --------- -->
</div>
<div class="container">
<div class="left-sidebar">
<div class="imp-links">
<a href="try2.php"><img src="images/home.png"> Home</a>
<a href="account.php"><img src="images/User-image.png"> Account</a>
</div>
</div>
<!----------------- middle content--------- -->
<div class="main-content">
<h2>Search for friends</h2>
<form action="phpfunctions/searchresults.php" method="GET" id="searchform">
<label for="search_username">Search for username:</label>
<input type="text" id="search_username" name="search_username" required>
<button type="submit">Add Friend</button>
</form>
<h2>Your friends</h2>
<div id="friends.list">
<?php
if (!empty($friends)) {
echo '<ul>';
foreach ($friends as $friend) {
echo '<li>';
echo 'Username: ' . htmlspecialchars($friend['member_username']) . '<br>';
echo 'First Name: ' . htmlspecialchars($friend['member_firstname']) . '<br>';
echo 'Last Name: ' . htmlspecialchars($friend['member_lastname']);
echo '</li>';
}
echo '</ul>';
} else {
echo 'You have no friends yet.';
}
?>
</div>
</div>
</body>
</html>