-
Notifications
You must be signed in to change notification settings - Fork 0
/
emailqueries.php
53 lines (53 loc) · 1.42 KB
/
emailqueries.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
<?php
include('./includes/session_timeout.inc.php');
include('./includes/session_var_setup.inc.php');
$sql = "SELECT email FROM users WHERE ";
switch(@$_POST['type']):
case 1:
$sql .= "role = 'trainee'";
break;
case 2:
$sql .= "role = 'trainer'";
break;
case 3:
$sql .= "role = 'trainee' && showchoice = 0";
break;
case 4:
$sql .= "role = 'trainee' && showchoice != 0";
break;
case 5;
$sql .= "role = 'trainee' && quizscore < 0 && showchoice != 0";
break;
case 6:
$sql .= "role = 'trainee' && quizscore >" . $setting['min_quiz_grade'];
break;
case 7:
$sql .= "role = 'trainee' && quizscore <" . $setting['min_quiz_grade']
. " && quizscore > 0";
break;
default:
$sql .= "role != 'admin'";
break;
endswitch;
$result = $conn->query($sql);
?>
<form name="selectthings" method="post" action="">
<select name="type">
<?php
$things = array("All Emails", "Trainees", "Trainers", "Unregistered Trainees",
"Registered Trainees", "Trainees who haven't completed the quiz", "Complete Trainees", "Remedial Trainees");
for($i = 0; $i < sizeof($things); $i++) {
echo '<option value="' . $i . '" ';
if (@$_POST['type'] == $i){ echo 'selected="yes"';}
echo '>' . $things[$i] . '</option' . ">\n";
}?>
</select>
<input type="submit" value="Submit" name="submit">
</form>
<?php
if (@$result){
while($row = $result->fetch_assoc()) {
echo $row['email'] . "\n<br />";
}
}
?><p><a href="index.php">Home</a></p>