-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfriends.php
145 lines (129 loc) · 6.39 KB
/
friends.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
<!DOCTYPE html>
<html lang="en">
<?php
require('connect-db.php');
session_start();
if (isset($_SESSION['user'])) {
$username = $_SESSION['user'];
}
?>
<head>
<link rel="apple-touch-icon" sizes="180x180" href="icon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="icon/favicon-16x16.png">
<link rel="manifest" href="icon/site.webmanifest">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Rubik&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="./themes/purple.css">
<link rel="stylesheet" id="switcher-id" href="">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Vivian Tran vt5en & Valerie Young vy5br">
<meta name="description" content="Assignment 1">
<title>queueAble: Finding Time for What's Important</title>
<style type="text/css">
h1 {font-family: 'Rubik', Arial;
}
h2 {font-family: 'Rubik', 'Arial';
font-size: 25px;
}
p {font-family: 'Rubik', 'Arial';
}
</style>
</head>
<body>
<?php include('navbar.php');
if (!isset($_SESSION['user'])) {
echo "<script>
alert('You are not logged in');
window.location.href='login.php';
</script>";
}
?>
<?php
if (isset($_SESSION['user'])) {?>
<center><h1>My Friends</h1>
<button type="submit" class="btn"><a style="color: white;" href="http://localhost:4200">New Friend Request</a></button>
</center>
</br>
<?php
$user = $_SESSION['user'];
$query = "SELECT * FROM friends WHERE name=:username ORDER BY f_name";
$statement = $db->prepare($query);
$statement->bindParam(':username', $user);
$statement->execute();
$friends_info = $statement->fetchAll();
$statement->closecursor();
$output = "<h2>
<div class='container'>
<div class='row'>";
if (empty($friends_info) && isset($_SESSION['user'])) {
echo "<h1 style='text-align:center;'>You don't have any friends right now. Request someone!</h1>";
}
echo "<div class='row'>";
foreach ($friends_info as $row) {
echo "<div class='col-sm-3'>";
echo "<div class='card' style='height: 15em; width: 20em; margin-bottom: 5vh; margin-left: 2vh;'>";
echo "<div class='card-body'>";
//friend name
echo "<h1 style='text-align:center;'>";
echo $f_name = $row['f_name'];
echo "</h1>";
//friend
echo "<p><b> Friend's Email: </b>";
echo $f_email = $row['f_email'];
echo "</p>";
//description
echo "<p style='margin-bottom: 2vh;'><b> Message: </b>";
echo $message = $row['message'];
echo "</p>";
echo "<div style='position: absolute; bottom: 5vh; align-items: center; justify-content: center;'>";
echo '<input type="hidden" name="f_name" value="' . $row['f_name'] . '" />';
echo '<input type="hidden" name="f_email" value="' . $row['f_email'] . '" />';
echo "</form>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
echo "</div>";
echo "</div>";
echo "</div>";
}
echo "</div>";
$query = "SELECT * FROM settings WHERE username=:username";
$statement = $db->prepare($query);
$statement->bindParam(':username', $username);
$statement->execute();
$settings_info = $statement->fetchAll();
$theme = $statement->fetchAll();
$statement->closecursor();
foreach ($settings_info as $row) {
$theme = $row['theme'];
if ($theme == "light"){
echo "<script>";
echo "document.getElementById('switcher-id').href = './themes/light.css';";
echo "</script>";
}
if ($theme == "sky"){
echo "<script>";
echo "document.getElementById('switcher-id').href = './themes/sky.css';";
echo "</script>";
}
if ($theme == "purple"){
echo "<script>";
echo "document.getElementById('switcher-id').href = './themes/purple.css';";
echo "</script>";
}
if ($theme == "dark"){
echo "<script>";
echo "document.getElementById('switcher-id').href = './themes/dark.css';";
echo "</script>";
}
}
?>
</body>
<?php include('./footer.php'); ?>
</html>