-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathsendmsg.php
42 lines (40 loc) · 982 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
41
42
<?php
session_start();
if(!isset($_SESSION['useremail'])){
echo "Access Denied";
}else{
if(isset($_POST['submit'])){
$sender = $_POST['senderid'];
$r = $_POST['doccat2'];
@$to = $_POST['docho2'];
$subject = $_POST['sub'];
$msg = $_POST['msg'];
$dt = date('Y-m-d');
$tm = date('H:i');
if($r == "Choose" || $tm == "Choose"){
echo '<script>';
echo 'alert("Oh ! You forget to select doctor");';
echo 'window.location.href="patient.php" ';
echo '</script>';
}else{
include('includes/conn.php');
$status = "unread";
$q = "INSERT INTO sentmsg VALUES ('','$sender','$to','$subject','$msg','$status','$dt','$tm');";
$r = mysqli_query($con,$q);
if($r = true){
echo '<script>';
echo 'alert("Message Sent Successfully");';
echo 'window.location.href="patient.php" ';
echo '</script>';
}else{
echo '<script>';
echo 'alert("Message Not Sent");';
echo 'window.location.href="patient.php" ';
echo '</script>';
}
}
}else{
echo "Invalid Action";
}
}
?>