-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfollow.php
35 lines (29 loc) · 1.37 KB
/
follow.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
<?php
include_once 'connect.php';
$follower = $_GET['follower'];
$following = $_GET['following'];
$return = $_GET['return'];
if($return == 'explore'){
$for_us = $_GET['for'];
$get = $_GET['get'];
}
$create_relation = mysqli_query ($conn, " INSERT INTO
followings (username, following)
VALUES ('$follower','$following')"
);
if($create_relation){
$increment_follower = mysqli_query ($conn, " UPDATE users
SET followers = followers + 1
WHERE username = '$following'"
);
$increment_following = mysqli_query ($conn, " UPDATE users
SET followings = followings + 1
WHERE username = '$follower'"
);
}
if($return == 'profile')
header("Location: profile.php?curr_us=$follower&profile_for=$following");
else if($return == 'explore')
header("Location: explore.php?curr=$follower&for=$for_us&get=$get");
exit();
?>