-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendAdminMsgProcess.php
More file actions
37 lines (28 loc) · 861 Bytes
/
sendAdminMsgProcess.php
File metadata and controls
37 lines (28 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
29
30
31
32
33
34
35
36
37
<?php
session_start();
include "connection.php";
$msg_txt = $_POST["t"];
$receiver;
if(isset($_POST["e"])){
$receiver = $_POST["e"];
}
$sender;
if (isset($_SESSION["u"])) {
$sender = $_SESSION["u"]["email"];
} else if (isset($_SESSION["au"])) {
$sender = $_SESSION["au"]["email"];
}
$d = new DateTime();
$tz = new DateTimeZone("Asia/Colombo");
$d->setTimezone($tz);
$date = $d->format("Y-m-d H:i:s");
if (!empty($receiver)) {
Database::iud("INSERT INTO `chat`(`content`,`date_time`,`status`,`from`,`to`) VALUES
('" . $msg_txt . "','" . $date . "','0','" . $sender . "','" . $receiver . "')");
echo ("success1");
} else {
Database::iud("INSERT INTO `chat`(`content`,`date_time`,`status`,`from`,`to`) VALUES
('" . $msg_txt . "','" . $date . "','0','" . $sender . "','disandurodrigo@gmail.com')");
echo ("success2");
}
?>