did stuff

This commit is contained in:
Logan McInnis
2019-12-02 18:36:54 -08:00
parent d4f7ac7387
commit 0f7bf31a62
3 changed files with 127 additions and 0 deletions

27
var/www/acceptFriend.php Normal file
View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "web";
$password = "Password456";
$dbname = "computer";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO FriendList VALUES user1, argv[0], true";
$result = mysqli_query($conn, $sql);
$sql = "UPDATE FriendList SET confirm = true WHERE username = argv[0] and friend = user1";
$result = mysqli_query($conn, $sql);
?>
</body>
</html>

48
var/www/friends.php Normal file
View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">Friend List</h2>
<?php
$servername = "localhost";
$username = "web";
$password = "Password456";
$dbname = "computer";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT friend FROM friendlist WHERE username = 'user1' and confirm = true";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
echo "friends: " . $row["friend"]. ;
echo "<br>";
}
}
else
{
echo "0 results";
}
?>
</body>
</html>

52
var/www/pendingFriend.php Normal file
View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<body>
<style>
body
{
background-color: #3B5998;
}
</style>
<h2><font color="white">Friendbook</h2>
<?php
$servername = "localhost";
$username = "web";
$password = "Password456";
$dbname = "computer";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT friend FROM friendlist WHERE username = 'user1' and confirm = false";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
echo "friends: " . $row["friend"]. ;
echo "<button type='button' onclick='window.location.href = 'acceptFriend.php $row['friend']''>Accept Friend Request</button>";
echo "<br>";
}
}
else
{
echo "0 results";
}
?>
</body>
</html>