-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.php
More file actions
32 lines (30 loc) · 981 Bytes
/
compose.php
File metadata and controls
32 lines (30 loc) · 981 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
<?php
include_once('connection2.php');
echo"Enter Recipient name".PHP_EOL;
$handle=fopen("php://stdin","r");
$line=fgets($handle);
$recipient=trim($line);
$sendfrom=$_SESSION['username'];
echo "Enter subject of the message".PHP_EOL;
$line2=fgets($handle);
$subject=trim($line2);
$status="sent";
echo"------- Enter the message to be sent-------".PHP_EOL;
$line3=fgets($handle);
$message=trim($line3);
$db=mysql_query("select * from userinfo where username='$recipient'");
$row=mysql_num_rows($db);
if($row==1)
{
mysql_query("Insert into mails values('','$recipient','$sendfrom','$subject','$message','$status')");
mysql_query("Insert into logdetails values('','->','$recipient','$message','delivered','$status')");
mysql_query("Update logdetails set senid = concat(senid,'$sendfrom')where recid = '$recipient' ");
echo "Message Sent".PHP_EOL;
include 'user.php';
}
else
{
echo"Message sending failed--Please check the recipient name".PHP_EOL;
include 'user.php';
}
?>