-
Notifications
You must be signed in to change notification settings - Fork 2
/
lu_system.php
56 lines (44 loc) · 1.57 KB
/
lu_system.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
54
55
56
<?php
session_start();
include 'dbh.php';
ini_set('max_execution_time', 300); //setting the maximum execution time for mail sending
if(isset($_POST['datetime']))
{
$userId=mysqli_real_escape_string($conn,$_SESSION['id']);
$datetime=mysqli_real_escape_string($conn,$_POST['datetime']);
$sql1="INSERT INTO ms_schedule_table (userId,eventType,datetime) VALUES ('$userId',1,'$datetime')";
$result1=mysqli_query($conn,$sql1);
$sql="SELECT e_email_1,e_email_2,name FROM memberstable WHERE id='$userId'";
$result=mysqli_query($conn,$sql);
while($row=mysqli_fetch_assoc($result))
{
$name=$row['name'];
//email 1
$to = $row['e_email_1'];
$subject = $name.' has taken their lunch!';
$message = '<html>
<body>
'.$name.' has just had their lunch!
</body>
</html>';
$headers = 'From: sharvai101@gmail.com' . "\r\n" .
'Reply-To: sharvai101@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion()."\r\n";
$headers.="Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
//email 2
$to = $row['e_email_2'];
$subject = $name.' has taken their lunch!';
$message = '<html>
<body>
'.$name.' has just had their lunch!
</body>
</html>';
$headers = 'From: sharvai101@gmail.com' . "\r\n" .
'Reply-To: sharvai101@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion()."\r\n";
$headers.="Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
}
echo 'success';
}