-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.php
121 lines (101 loc) · 2.53 KB
/
email.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
<html>
<head>
<title>Send Volunteer Audit Emails</title>
</head>
<body>
<h1>WMFO Volunteer Email System</h1><br>
<table border="3">
<form action="" method="post">
<tr>
<td>Semester: </td><td>
<select name="Semester">
<?php
include 'commlib.php';
$conn = mysql_init();
$stmt = $conn->prepare("SELECT ID,TITLE FROM SEMESTER ORDER BY CREATION_TIME DESC");
$stmt->execute();
$stmt->bind_result($id, $title);
while ($stmt->fetch())
{
#printf("<option value='%s'>%s</option>\n", $id, $title);
echo "<option value='$id'";
if ($_POST['Semester'] == $id)
echo " selected";
echo ">$title</option>\n";
}
$stmt->close();
?>
</select></td></tr>
<tr><td>DJ: </td><td>
<select name="DJ">
<?php
$stmt = $conn->prepare("SELECT ID,L_NAME,F_NAME FROM DJ ORDER BY L_NAME ASC");
$stmt->execute();
$stmt->bind_result($id, $lname, $fname);
while ($stmt->fetch())
{
#printf("<option value='%s'>%s, %s</option>\n", $id, $lname, $fname);
echo "<option value='$id'";
if ($_POST['DJ'] == $id)
echo " selected";
echo ">$lname, $fname</option>\n";
}
$stmt->close();
?>
</select></td></tr>
<tr><td colspan="2"><input type="submit" value="Email Volunteer Records">
</form></td></tr></table>
<?php
if (
isset($_REQUEST['DJ']) &&
isset($_REQUEST['Semester']) )
{
$stmt = $conn->prepare("SELECT F_NAME,L_NAME,TITLE FROM DJ,SEMESTER WHERE DJ.ID=? AND SEMESTER.ID=?");
$stmt->bind_param("ii", $_REQUEST['DJ'], $_REQUEST['Semester']);
$stmt->execute();
$stmt->bind_result($first, $last, $semester);
$stmt->fetch();
printf("<h1>Volunteer Record for %s %s in %s</h1>", $first, $last, $semester);
$stmt->close();
}
/*
<table border="3">
<tr>
<th>Month</th>
<th>Day</th>
<th>Year</th>
<th>Hours</th>
<th>Type</th>
<th>Description</th>
<th>Delete</th>
</tr>
*/
?>
<?php
if (
isset($_REQUEST['DJ']) &&
isset($_REQUEST['Semester']) )
{
$stmt = $conn->prepare("SELECT DDAY,DMONTH,DYEAR,NUM_HOURS,DESCRIPTION,SUB_BOOL,ID FROM VOLUNTEER WHERE DJ_ID=? AND SEMESTER_ID=? ORDER BY DYEAR DESC, DMONTH DESC, DDAY DESC");
$stmt->bind_param("ii", $_REQUEST['DJ'], $_REQUEST['Semester']);
$stmt->execute();
$stmt->bind_result($month, $day, $year, $hours, $desc, $sub_bool, $id);
while ($stmt->fetch())
{
if ($sub_bool == 0)
{
$type = "VOL";
}
else
{
$type = "SUB";
}
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><a href='./volunteer?delete=%s&DJ=%s&Semester=%s'>X</a></td></tr>",
$day, $month, $year, $hours, $type, $desc, $id, $_REQUEST['DJ'], $_REQUEST['Semester']
);
}
}
?>
</table>
<?php footer(); ?>
</body></html>