-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddFriend.php
More file actions
28 lines (25 loc) · 861 Bytes
/
addFriend.php
File metadata and controls
28 lines (25 loc) · 861 Bytes
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
<?php
include("connection.php");
if(isset($_POST['AddFriend'])){
$user_id=$_POST['user_id'];
$friend_id=$_POST['friend_id'];
$user_name=$_POST['username'];
echo $user_id.' ';
echo $friend_id.' ';
echo $user_name.' ';
$query = "INSERT INTO `friendships`(`user_id`, `friend_id`, `friend_type`) VALUES ('".$friend_id."','".$user_id."','0')";
$result = mysqli_query($link, $query);
header("Location: profile.php?username=".$user_name);
}
if(isset($_POST['AddFriend1'])){
$user_id=$_POST['user_id'];
$friend_id=$_POST['friend_id'];
$user_name=$_POST['username'];
echo $user_id.' ';
echo $friend_id.' ';
echo $user_name.' ';
$query = "INSERT INTO `friendships`(`user_id`, `friend_id`, `friend_type`) VALUES ('".$friend_id."','".$user_id."','0')";
$result = mysqli_query($link, $query);
header("Location: search.php");
}
?>