forked from shamilcm/wireus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendmsg.php
executable file
·40 lines (35 loc) · 993 Bytes
/
sendmsg.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
<?php
session_start();
if($_SESSION['authuser']!=1)
{
header("Location:index.php");
exit;
}
include('lib/connectionfile.php');
$sender=$_POST['sender'];
$recipent=$_POST['recipent'];
$msg=$_POST['msg'];
$dt=date('Y-m-d H:i:s');
$privacy=$_POST['privacy'];
if($msg && $sender!=$recipent)
{
$count1=dbconfn()->prepare("INSERT INTO w_msgs(sender,recipent,content,send_date_time,privacy) VALUES('$sender','$recipent','$msg','$dt','$privacy')");
$count1->execute();
header("Location:profile?id=$recipent&pid=msgs");
exit;
}
elseif($msg && $sender==$recipent)
{
$count1=dbconfn()->prepare("DELETE FROM w_msgs where sender=$sender and recipent=$recipent;");
$count1->execute();
$count2=dbconfn()->prepare("INSERT INTO w_msgs(sender,recipent,content,send_date_time,privacy) VALUES('$sender','$recipent','$msg','$dt','$privacy')");
$count2->execute();
header("Location:profile?id=$recipent");
exit;
}
else
{
header("Location:profile?id=$recipent");
exit;
}
?>