-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontacts.php
More file actions
53 lines (49 loc) · 1.42 KB
/
contacts.php
File metadata and controls
53 lines (49 loc) · 1.42 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
<?php
// Import util functions
require("util.php");
checkSession();
dbConnect();
$contacts = getContacts($id);
$sent = getSentRequests($id);
$received = getReceivedRequests($id);
echoHeader(1);
?>
<div id="content">
<div id = "contacts">
<form method="get" action="search.php">
<input type="hidden" name="type" value="user" />
<p id="label">Search for user: <input type="text" name="query" />
<input type="submit" value="Search" /></p>
</form>
<?php
if (!empty($errorMessage)) { echo($errorMessage); }
// Display received requests if not empty
if (!empty($received)) {
echo("<h3>Received Requests</h3>");
}
foreach ($received as $contact) {
$result = userFromID($contact);
echoUser($result);
}
// Display sent requests if not empty
if (!empty($sent)) {
echo("<h3>Sent Requests</h3>");
}
foreach ($sent as $contact) {
$result = userFromID($contact);
echoUser($result);
}
echo("<h3>Contacts</h3>");
if (empty($contacts)) {
echo("<h4>You have no contacts.</h4>");
}
// Display contacts
foreach ($contacts as $contact) {
$result = userFromID($contact);
echoUser($result);
}
?>
</div>
</div>
</body>
</html>