forked from shamilcm/wireus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserconnection.php
executable file
·53 lines (38 loc) · 1.9 KB
/
userconnection.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
<?php
session_start();
if($_SESSION['authuser']!=1)
header("Location:index.php");
include('lib/connectionfile.php');
$username1=$_POST['username1'];
$username2=$_POST['username2'];
$status=$_POST['status'];
if($status=='A')
{
$count1=dbconfn()->prepare("DELETE FROM w_connections WHERE (username1='$username1' and username2='$username2') or (username1='$username2' and username2='$username1')");
$count1->execute();
header("Location:profile?id=$username1");
}
if($status=='R' || $status=='S' )
{
$count1=dbconfn()->prepare("DELETE FROM w_connections WHERE username1='$username1' and username2='$username2'");
$count1->execute();
if($status=='S') //Status S: For Sent Invites from Homepage
header("Location:home");
else
header("Location:profile?id=$username2");
}
if($status=='I' || $status=='J')
{
$count1=dbconfn()->prepare("UPDATE w_connections SET status='A' WHERE username1='$username1' and username2='$username2'");
$count1->execute();
if($status=='J') //Status J: For Requests from Homepage
header("Location:home");
else
header("Location:profile?id=$username1");
}
if($status=='O')
{
$count1=dbconfn()->exec("INSERT INTO w_connections VALUES('$username1','$username2','R')");
header("Location:profile?id=$username2");
}
?>