Added functionality for add friend buttons.
This commit is contained in:
30
website/public/edit_friendship.php
Normal file
30
website/public/edit_friendship.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
session_start();
|
||||
require("../queries/friendship.php");
|
||||
require("../queries/user.php");
|
||||
|
||||
if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
|
||||
echo "Not enough arguments.";
|
||||
return;
|
||||
}
|
||||
|
||||
$friendship_status = getFriendshipStatus($_POST["userID"]);
|
||||
echo "\nfriendshipstatus: $friendship_status";
|
||||
echo "You: " . $_SESSION["userID"];
|
||||
echo "other user: " . $_POST["userID"];
|
||||
|
||||
|
||||
if(!empty($_POST["request"]) AND $friendship_status == 0) {
|
||||
echo "request";
|
||||
requestFriendship($_POST["userID"]);
|
||||
} else if(!empty($_POST["delete"]) AND in_array($friendship_status, array(1, 2, 3))) {
|
||||
echo "delete";
|
||||
removeFriendship($_POST["userID"]);
|
||||
} else if (!empty($_POST["accept"]) AND $friendship_status == 3) {
|
||||
echo "accept";
|
||||
acceptFriendship($_POST["userID"]);
|
||||
}
|
||||
|
||||
$username = getUsername($_POST["userID"]);
|
||||
|
||||
header("Location: profile.php?username=$username");
|
||||
@@ -15,11 +15,14 @@ include("../queries/nicetime.php");
|
||||
|
||||
if(empty($_GET["username"])) {
|
||||
$userID = $_SESSION["userID"];
|
||||
echo "USERNAME NOT GIVEN";
|
||||
} else {
|
||||
$userID = getUserID($_GET["username"]);
|
||||
}
|
||||
|
||||
$user = selectUser($userID);
|
||||
echo "User ID: $userID";
|
||||
|
||||
$user = selectUser($_SESSION["userID"], $userID);
|
||||
$profile_friends = selectAllFriends($userID);
|
||||
$profile_groups = selectAllUserGroups($userID);
|
||||
$posts = selectAllUserPosts($userID);
|
||||
|
||||
@@ -81,8 +81,9 @@ div.posts .post form textarea.newpost {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.profile-button {
|
||||
input.profile-button {
|
||||
float: right;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
background-color: #4CAF50;
|
||||
|
||||
Reference in New Issue
Block a user