-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgateCAR.php
73 lines (61 loc) · 1.72 KB
/
gateCAR.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html>
<title> assigning car... </title>
<body>
<?php
include_once 'inc/config.php';
include_once 'inc/functions.php';
$getID = $_GET['ID'];
$getCODE = $_GET['code'];
$id = $getID;
$sql = "UPDATE carbasic
SET Status = $getCODE WHERE ID = $getID";
if ($conn->query($sql) === TRUE){
$i = 0;
$j = 0;
$emailarray = array();
$getcar = mysqli_query($conn, "SELECT * FROM `carbasic` WHERE ID = '$id'");
while($row = $getcar->fetch_assoc()){
$creatorsid = $row['creatorid'];
if ($getcar){
$getemails = mysqli_query($conn, "SELECT * FROM `users` WHERE `users`.`id` = '$creatorsid'");
if ($getemails){
while ($arow = $getemails->fetch_assoc()){
$emailarray[$i] = $arow['email'];
$i++;
}
$to = "";
$j = 0;
while ($j < $i){
if ($j == 0){
$to = $to . $emailarray[0];
}
else{
$to = $to . "," . $emailarray[$j];
}
$j++;
}
if ($getCODE == 2){
$subject = 'CAR Approved: ' . $row['Name'];
$message = 'The CAR titled ' . $row['Name'] . ' has been approved. Please begin creating a solution proposal.';
}
else{
$subject = 'CAR Rejected: ' . $row['Name'];
$message = 'The CAR titled ' . $row['Name'] . ' has been rejected. Please revise the CAR and re-submit for approval.';
}
$header = 'From: car_notifications@jedl.com';
//echo $header . "<br>" . "To: " . $to . "<br><br>" . "subject: " . $subject . "<br><br>message: " . $message;
$test = mail ($to, $subject, $message, $header);
//die ("mail sent");
//var_dump($test);
}
}
}
header("Location:http://car.jayashree-electrodevices.com/dispreq.php");
//echo "<script>window.close();</script>";
}
else{
echo "Error: " . $sql . "<br>" . $conn->error;
}
?>
</body>
</html>