-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
125 lines (94 loc) · 5.16 KB
/
settings.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
<?php
ini_set('display_errors', 'Off');
session_start();
if (!isset($_SESSION['user']) || $_SESSION['authenticated'] == false) {
header("location: test.php");
}
$status = isset($_GET['status']) ? $_GET['status'] : '';
$servername = "localhost";
$username = "root"; //Eneter Username for ESSCC Earthquake DB
$database="moose-pirates";
$password="MYPASSWORD123";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_select_db( $conn, "moose-pirates") or die( "Unable to select database");
$query2 = "Select * from users where email <> '". $_SESSION['user']."' AND id not IN (Select friend_id FROM friends where id IN (SELECT id from users where email = '". $_SESSION['user']."' ))";
$result2 = mysqli_query($conn, $query2);
$query3 = "Select keyword from user_keywords where id in (SELECT id from users where email = '". $_SESSION['user'] ."' )";
$keywords = mysqli_query($conn, $query3);
$query4 = "Select * from users where email <> '". $_SESSION['user'] ."' AND id IN (Select friend_id FROM friends where id IN (SELECT id from users where email = '". $_SESSION['user'] ."' ))";
$friends = mysqli_query($conn, $query4);
?>
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<meta charset="UTF-8">
<title>Moose Pirates</title>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<div class="header_logo" id="logo">
<a href="index.php">
<img src="image/moose_news.png" class="img-responsive" alt="Moose Pirates" style="height:75px">
</a>
</div>
</div>
<div class="navbar-header navbar-right" >
<a class="navbar-brand" href="settings.php"><span class="glyphicon glyphicon glyphicon-cog" aria-hidden="true"></span></a>
</div>
</div>
</nav>
<?php if ($status == 'error') { echo '<div class=" center alert alert-danger">'. $_GET['message']. '</div>';} elseif ($status == 'success') { echo '<div class=" center alert alert-info">'. $_GET['message']. '</div>';}?>
<div class="row">
<div class="infoList col-md-6 clearfix" >
<form action="insert.php" method="post">
<label style="color: #FFF">Keyword:</label> <input type="text" name="keyword">
<input class="pull-right" type="submit">
</form>
</br>
<ul class="list-group">
<?php while ($row = mysqli_fetch_assoc($keywords)) {
echo '<li class="list-group-item">'.$row['keyword'].' <span class="badge"><a href="deleteKeyword.php?keyword='. $row['keyword'] .'"><span class="glyphicon glyphicon glyphicon-remove" aria-hidden="true"></span></a></span></li>';
} ?>
</ul>
</br>
<h3> Trending Key Words</h3>
<ul class="list-group">
<li class="list-group-item"> Batman <span class="badge"><a href="insertKeyword.php?keyword=Batman"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span></a></span></li>
<li class="list-group-item"> Joss Whedon <span class="badge"><a href="insertKeyword.php?keyword= <?php echo urlencode('Joss Whedon')?>"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span></a></span></li>
<li class="list-group-item"> Moose News <span class="badge"><a href="insertKeyword.php?keyword=<?php echo urlencode('Moose News')?>"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span></a></span></li>
<li class="list-group-item"> The Great Escape <span class="badge"><a href="insertKeyword.php?keyword=<?php echo urlencode('The Great Escape')?>"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span></a></span></li>
<li class="list-group-item"> Donald Trump <span class="badge"><a href="insertKeyword.php?keyword=<?php echo urlencode('Donald Trump')?>"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span></a></span></li>
</ul>
</div>
<div class="infoList col-md-6 clearfix" >
<form action="insertFriend.php" method="post">
<label style="color: #FFF"> Add a Friend: </label> <select name="friend" id="friend" required>
<option disabled selected>-- <?= ('Add a Friend'); ?> --</option>
<?php while ($row = mysqli_fetch_assoc($result2)) {
echo "<option value='". $row['id'] ."'>".$row['name'] ."</option>";
} ?>
</select>
<input class="pull-right" type="submit">
</form>
</br>
<ul class="list-group">
<?php while ($row = mysqli_fetch_assoc($friends)) {
echo '<li class="list-group-item">'.$row['name'].' <span class="badge"><a href="deletefriend.php?friend='.$row['id'].'"><span class="glyphicon glyphicon glyphicon-remove" aria-hidden="true"></span></a></span></li>';
} ?>
</ul>
</div>
</div>
<div class="center">
<a href="logout.php" class="btn btn-lg btn-primary" >Log out of <?php echo $_SESSION['user']; ?></a>
</div>
</body>
</html>