-
Notifications
You must be signed in to change notification settings - Fork 0
/
commitCAR.php
51 lines (45 loc) · 1.25 KB
/
commitCAR.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
<?php
include_once 'inc/filteruser.php';
include_once 'inc/config.php';
$id = $_GET['ID'];
$add = mysqli_query($conn, "UPDATE `carbasic` SET Status = 1 WHERE ID = '$id'");
$i = 0;
$j = 0;
$emailarray = array();
if ($add){
$getcar = mysqli_query($conn, "SELECT * FROM `carbasic` WHERE ID = '$id'");
while($row = $getcar->fetch_assoc()){
if ($getcar){
$getemails = mysqli_query($conn, "SELECT * FROM `users` WHERE active > 1");
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++;
}
$subject = 'CAR Submitted: ' . $row['Name'];
$message = 'A new CAR has been submitted. Please review and approve or ask the author of the CAR to edit. This is an automated message, do not reply.';
$header = 'From: car_notifications@jedl.com';
$test = mail ($to, $subject, $message, $header);
//echo "<script>window.close();</script>";
//var_dump($test);
}
}
}
header("Location:http://car.jayashree-electrodevices.com/dispmine.php");
//echo "<script>window.close();</script>";
}
else{
echo "problem";
}
?>