-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin_promotionalEmail.php
218 lines (153 loc) · 6.71 KB
/
admin_promotionalEmail.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
session_start();
include_once 'includes/covaid_database.php';
include_once 'includes/ConnectDB.php';
if(! $conn ) {
die('Could not connect: ' . mysqli_error());
}
$sql = "SELECT * FROM user_info";
$retval = mysqli_query( $conn,$sql);
if(! $retval ) {
die('Could not get data: ' . mysqli_error());
}
$_SESSION['user_id']=(isset($_SESSION['user_id']))?$_SESSION['user_id']:'No Email Shown';
$result=mysqli_num_rows($retval);
$user_array=[];
$_SESSION['dontsend']=(isset($_SESSION['dontsend']))?$_SESSION['dontsend']:array("Admin@domain.com");
if($result>0){
while ( $row = mysqli_fetch_assoc($retval)){
$check=TRUE;
foreach($_SESSION['dontsend'] as $value){
if($value===$row['user_id']){
$check=FALSE;
}
}
if($check===TRUE){
array_push($user_array,array($row['user_first'],$row['user_id']));
}
}
}
?>
<?php
//Header
$page = "Promotional Email";
include("includes/admin_header.php");
//Rerieve review information
?>
<main class="main_content">
<header class="header">
<ion-icon name="pricetags-outline" class="header-icon"></ion-icon>
<span class="header-name">Promotional Emails</span>
</header>
<div class="wrapper" style="padding-left:100px;padding-right:120px;">
<div class="replycss" style="padding-left:320px; padding-top:50px;">
<form method="POST" action="">
<table style="border-spacing=15px;">
<tr>
<td>
<span style="font-size:1.5em;font-weight:bold;float:left;">User List: </span>
</td>
</tr>
<tr>
<td>
<div style="overflow:auto;width:550px;hieght:250px;background-color:white;border:thick solid white;">
<table style="border-spacing:15px;">
<?php
foreach($user_array as $id){
$var1=$id[0];
$var2=$id[1];
if($var1===''){
echo "<tr><td>No Name Yet</td><td>$var2</td></tr>";
}
else{
echo "<tr><td>$var1</td><td>$var2</td></tr>";
}
}
?>
</table>
</div>
</td>
</tr>
</table>
<br />
<table style="border-spacing=25px;">
<tr>
<td><textarea name="adminReply" id="adminReply" rows="4" cols="80" style="font-size: large;" maxlength="250">Hello, this is COVAID adimistrator. New Promotions are coming soon. Be prepared for Chrismas discounts!</textarea></td>
</tr>
<tr>
<td>
Enter user_login_email that you do not want to send the email:
</td>
</tr>
<tr>
<td>
<input type="text" style="width:250px;heigh:40px;border:thin solid gray;" name="remove" placeholder="user'email" /><br />
</td>
<td>
<input type="submit" style="position:absolute;left:850px;width:100px;height:30px;margin-top:-10px;background-color:dodgerblue;color:white;border:0 none;cursor:pointer;" value="confirm" name="removebutton" />
</td>
<td>
<input type="submit" style="position:absolute;left:960px;width:100px;height:30px;margin-top:-10px;background-color:gray;color:white;border:0 none;cursor:pointer;" value="Reset" name="reset" />
</td>
</tr>
<tr style ="padding-top: 1em;">
<td><input type="submit" name="submit" class="edit_product" value="submit" /></td>
</tr>
</table>
</form>
</div>
</div>
<?php
if(isset($_POST['submit'])){
$msg=(isset($_POST['adminReply']))?$_POST['adminReply']:"";
$email="";
$name="Customer";
foreach($user_array as $mail){
$email=$mail[1];
$name=$email[0];
include("includes/Mailer_review/mailerTemplate.php");
}
$_SESSION['dontsend']=array("Admin@domain.com");
echo "<script type='text/javascript'>alert('Emails have been successfully sent to users');window.location.href='replyReview_response.php';</script>";
}
elseif(isset($_POST['removebutton'])){
$email=(isset($_POST['remove']))?$_POST['remove']:"";
if($email!==""){
array_push($_SESSION['dontsend'],$email);
}
echo '<script type="text/javascript">window.location.href="replyReview_response.php";</script>';
?>
<script>
</script>
<?php }
elseif(isset($_POST['reset'])){
$_SESSION['dontsend']=array("Admin@domain.com");
echo '<script type="text/javascript">window.location.href="replyReview_response.php";</script>';
}
?>
</main>
<!-- JS script-->
<script src="https://unpkg.com/ionicons@5.2.3/dist/ionicons.js "></script>
<script src="js/admin.js "></script>
</body>
</html>
<?php
/*
$sql = "UPDATE products
SET name = '$productName', price = '$productPrice', specialPrice = $specialPrice, description = '$productDesc', inventory = '$productInventory', modified = '$modified'
WHERE id = $productID;";
mysqli_query($conn, $sql);
//Goes back to the admin page of the product after updating the information
$admin_link;
$sql = "SELECT * FROM products WHERE id = $productID;";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
//Makes sure that the connection was established
if($resultCheck > 0){
$row = mysqli_fetch_assoc($result);
$admin_link = $row['adminpageLink'];
}
//Go back to the page
header("Location: $admin_link"."?review=success");
*/
?>