This repository was archived by the owner on Oct 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmembers.php
More file actions
71 lines (55 loc) · 1.87 KB
/
members.php
File metadata and controls
71 lines (55 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
<?php
require_once 'header.php';
include_once 'src/Database.php';
include_once 'src/Member.php';
include_once 'src/Friend.php';
$db = new Database();
if (!$loggedin) die("</div></body></html>");
if (isset($_GET['view']))
{
$view = $db->sanitizeString($_GET['view']);
if ($view == $user) $name = "Your";
else $name = "$view's";
echo "<h3>$name Profile</h3>";
$db->showProfile($view);
echo "<a data-role='button' data-transition='slide'
href='messages.php?view=$view&r=$randstr'>View $name messages</a>";
die("</div></body></html>");
}
if (isset($_GET['add']))
{
$friend = new Friend($_GET['add']);
$friend->setFriend($user);
$friend->insertIfExists();
}
elseif (isset($_GET['remove']))
{
$friend = new Friend($_GET['remove']);
$friend->setFriend($user);
$friend->removeFriendship();
}
$result = Friend::showAll();
$num = $result->rowCount();
while ($row = $result->fetch())
{
if ($row['user'] == $user) continue;
echo "<li><a data-transition='slide' href='members.php?view=" .
$row['user'] . "&$randstr'>" . $row['user'] . "</a>";
$follow = "follow";
$result1 = Friend::getFollowingStatus($row['user'], $user);
$t1 = $result1->rowCount();
$result1 = Friend::getFollowerStatus($row['user'], $user);
$t2 = $result1->rowCount();
if (($t1 + $t2) > 1) echo " ↔ is a mutual friend";
elseif ($t1) echo " ← you are following";
elseif ($t2) { echo " → is following you";
$follow = "recip"; }
if (!$t1) echo " [<a data-transition='slide'
href='members.php?add=" . $row['user'] . "&r=$randstr'>$follow</a>]";
else echo " [<a data-transition='slide'
href='members.php?remove=" . $row['user'] . "&r=$randstr'>drop</a>]";
}
?>
</ul></div>
</body>
</html>