-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaterial_request_result.php
More file actions
534 lines (438 loc) · 28.4 KB
/
material_request_result.php
File metadata and controls
534 lines (438 loc) · 28.4 KB
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
<?php
ob_start();
include ("./functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Request Result Form</title>
<link rel="stylesheet" type="text/css" media="all" href="/includes/css/PrattCSS/screen.css" />
<link rel="stylesheet" type="text/css" media="all" href="/includes/css/PrattCSS/library_style.css" />
<style>
body{
background-color: #fff;
}
#content{
padding: 100px 0 0 0;
margin: auto;
float: none;
}
</style>
</head>
<body>
<div id="content">
<?php
//connect to the database
require('scripts/conn.php');
//general variables//
//timestamp must be full ymdhis to generate a unique primary key in sql
$timeStamp = date("Y-m-d H:i:s");
$name = isset($_POST['name']) ? strip_tags($_POST['name']) : '';
$email = isset($_POST['email']) ? strip_tags($_POST['email']) : '';
$prattID = isset($_POST['prattID']) ? strip_tags($_POST['prattID']) : '';
$people = isset($_POST['people']) ? strip_tags($_POST['people']) : '';
$department = isset($_POST['department']) ? strip_tags($_POST['department']) : '';
$reserve = isset($_POST['reserve']) ? strip_tags($_POST['reserve']) : '';
$matType = isset($_POST['matType']) ? strip_tags($_POST['matType']) : '';
$curriculum = isset($_POST['curriculum']) ? strip_tags($_POST['curriculum']) : '';
$notify = isset($_POST['notify']) ? strip_tags($_POST['notify']) : '';
//end general variables//
//course reserve variables//
$semester = isset($_POST['semester']) ? strip_tags($_POST['semester']) : '';
$cyear = isset($_POST['cyear']) ? strip_tags($_POST['cyear']) : '';
$cnum = isset($_POST['cnum']) ? strip_tags($_POST['cnum']) : '';
$cname = isset($_POST['cname']) ? strip_tags($_POST['cname']) : '';
$citation1 = isset($_POST['citation1']) ? strip_tags($_POST['citation1']) : '';
$citation2 = isset($_POST['citation2']) ? strip_tags($_POST['citation2']) : '';
$citation3 = isset($_POST['citation3']) ? strip_tags($_POST['citation3']) : '';
$citation4 = isset($_POST['citation4']) ? strip_tags($_POST['citation4']) : '';
$citation5 = isset($_POST['citation5']) ? strip_tags($_POST['citation5']) : '';
$citation6 = isset($_POST['citation6']) ? strip_tags($_POST['citation6']) : '';
$citation7 = isset($_POST['citation7']) ? strip_tags($_POST['citation7']) : '';
$citation8 = isset($_POST['citation8']) ? strip_tags($_POST['citation8']) : '';
$citation9 = isset($_POST['citation9']) ? strip_tags($_POST['citation9']) : '';
$citation10 = isset($_POST['citation10']) ? strip_tags($_POST['citation10']) : '';
$location = isset($_POST['location']) ? strip_tags($_POST['location']) : '';
$phone = isset($_POST['phone']) ? strip_tags($_POST['phone']) : '';
$instructName = isset($_POST['instructName']) ? strip_tags($_POST['instructName']) : '';
$instructEmail = isset($_POST['instructEmail']) ? strip_tags($_POST['instructEmail']) : '';
$instructorDepartment = isset($_POST['instructorDepartment']) ? strip_tags($_POST['instructorDepartment']) : '';
$instructorStatement = isset($_POST['instructorStatement']) ? strip_tags($_POST['instructorStatement']) : '';
//end course reserve variables//
//book variables
$bookTitle = isset($_POST['bookTitle']) ? strip_tags($_POST['bookTitle']) : '';
$bookAuthor = isset($_POST['bookAuthor']) ? strip_tags($_POST['bookAuthor']) : '';
$bookPublisher = isset($_POST['bookPublisher']) ? strip_tags($_POST['bookPublisher']) : '';
$bookYear = isset($_POST['bookYear']) ? strip_tags($_POST['bookYear']) : '';
$bookEdition = isset($_POST['bookEdition']) ? strip_tags($_POST['bookEdition']) : '';
$ISBN = isset($_POST['ISBN']) ? strip_tags($_POST['ISBN']) : '';
$bookPrice = isset($_POST['bookPrice']) ? strip_tags($_POST['bookPrice']) : '';
//end book variables
//periodical variables
$perTitle = isset($_POST['perTitle']) ? strip_tags($_POST['perTitle']) : '';
$perPublisher = isset($_POST['perPublisher']) ? strip_tags($_POST['perPublisher']) : '';
$perFrequency = isset($_POST['perFrequency']) ? strip_tags($_POST['perFrequency']) : '';
$perISSN = isset($_POST['perISSN']) ? strip_tags($_POST['perISSN']) : '';
$perPrice = isset($_POST['perPrice']) ? strip_tags($_POST['perPrice']) : '';
//end periodical variables
//electronic resources variables
$erTitle = isset($_POST['erTitle']) ? strip_tags($_POST['erTitle']) : '';
$erPublisher = isset($_POST['erPublisher']) ? strip_tags($_POST['erPublisher']) : '';
$erFrequency = isset($_POST['erFrequency']) ? strip_tags($_POST['erFrequency']) : '';
$erISSN = isset($_POST['erISSN']) ? strip_tags($_POST['erISSN']) : '';
$erPrice = isset($_POST['erPrice']) ? strip_tags($_POST['erPrice']) : '';
//end electronic resources variables
//video variables
$videoTitle = isset($_POST['videoTitle']) ? strip_tags($_POST['videoTitle']) : '';
$videoDirector = isset($_POST['videoDirector']) ? strip_tags($_POST['videoDirector']) : '';
$videoPublisher = isset($_POST['videoPublisher']) ? strip_tags($_POST['videoPublisher']) : '';
$videoFormat = isset($_POST['videoFormat']) ? strip_tags($_POST['videoFormat']) : '';
$videoYear = isset($_POST['videoYear']) ? strip_tags($_POST['videoYear']) : '';
$videoPrice = isset($_POST['videoPrice']) ? strip_tags($_POST['videoPrice']) : '';
//end electronic resources variables
if($name == ""){
echo "<b><font color='red'>Please enter your name.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//check for valid input and required fields/////
$error = 1;
$email = validateEmail("email", strip_tags($_POST['email']), TRUE);
$error = declareError(TRUE);
if($error){
echo "<br/> Please click Back button on your browser to return to the previous page";
return;
}
if(($reserve == "noReserve") && ($matType == "")){
echo "<b><font color='red'>Please select a material type.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//end check for required fields///
//check to see if this is for course reserve
//if not selected, give error
switch($reserve){
case "":
echo "<b><font color='red'>Please indicate if this is for course reserve</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
break;
// yes, the item is for course reserve, submit the reserve info
case "yesReserve":
if(($cnum == "") | ($semester == "") | ($cyear == "") | ($cname == "")){
echo "<b><font color='red'>Please enter complete course information.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($citation1 == ""){
echo "<b><font color='red'>Please enter a full citation for the item.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($location == ""){
echo "<b><font color='red'>Please enter a location.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($phone == ""){
echo "<b><font color='red'>Please enter a phone number.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($instructorStatement == ""){
echo "<b><font color='red'>You must agree to the compliance statement by typing your name.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//$libemail = 'selectors.library@pratt.edu';
$libemail = 'wmcmilli@pratt.edu';
//Create the email body.
$today = date('m/d/Y');
$body .="<p><b>Date : </b>". $today."</p>\r\n";
$body .="<p><b>Name : </b>".$name."</p> \n";
$body .="<p><b>E-mail * : </b>".$email." </p>\n";
$body .="<p><b>PrattID : </b>".$prattID."</p> \n";
$body .="<p><b>Student, Faculty, Staff or Other * : </b>".$people." </p>\n\n\n";
$body .="<p><b>Department : </b>".$department."</p> \n";
$body .="<p><b>Semester : </b>".$semester."</p> \n";
$body .="<p><b>Do You wish to be notified when item arrives? </b>".$notify."</p> \n";
$body .="<p><b>Course Year : </b>".$cyear."</p> \n";
$body .="<p><b>Course Number : </b>".$cnum."</p> \n";
$body .="<p><b>Course Name : </b>".$cname."</p> \n";
$body .="<p><b>Reserves Location : </b>".$location."</p> \n";
$body .="<p><b>Phone : </b>".$phone."</p> \n";
$body .="<p><b>Instructor Name : </b>".$instructName."</p> \n";
$body .="<p><b>Instructor Email : </b>".$instructEmail."</p> \n";
$body .="<p><b>Instructor Department : </b>".$instructorDepartment."</p> \n";
$body .="<p><b>Compliance Statement Agreed to by: </b>".$instructorStatement."</p> \n";
$body .="<p><b>Citation 1 : </b>".$citation1."</p> \n";
$body .="<p><b>Citation 2 : </b>".$citation2."</p> \n";
$body .="<p><b>Citation 3 : </b>".$citation3."</p> \n";
$body .="<p><b>Citation 4 : </b>".$citation4."</p> \n";
$body .="<p><b>Citation 5 : </b>".$citation5."</p> \n";
$body .="<p><b>Citation 6 : </b>".$citation6."</p> \n";
$body .="<p><b>Citation 7 : </b>".$citation7."</p> \n";
$body .="<p><b>Citation 8 : </b>".$citation8."</p> \n";
$body .="<p><b>Citation 9 : </b>".$citation9."</p> \n";
$body .="<p><b>Citation 10 : </b>".$citation10."</p> \n";
//form the db query
$query = sprintf("INSERT INTO purchase (timeStamp, name, email, phone, prattID, people, department, curriculum, notify, cyear, cnum, cname, location, instructName, instructEmail, instructorDepartment, instructorStatement, citation1, citation2, citation3, citation4, citation5, citation6, citation7, citation8, citation9, citation10) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($dbLink, $timeStamp),
mysqli_real_escape_string($dbLink, $name),
mysqli_real_escape_string($dbLink, $email),
mysqli_real_escape_string($dbLink, $phone),
mysqli_real_escape_string($dbLink, $prattID),
mysqli_real_escape_string($dbLink, $people),
mysqli_real_escape_string($dbLink, $department),
mysqli_real_escape_string($dbLink, $curriculum),
mysqli_real_escape_string($dbLink, $notify),
mysqli_real_escape_string($dbLink, $cyear),
mysqli_real_escape_string($dbLink, $cnum),
mysqli_real_escape_string($dbLink, $cname),
mysqli_real_escape_string($dbLink, $location),
mysqli_real_escape_string($dbLink, $instructName),
mysqli_real_escape_string($dbLink, $instructEmail),
mysqli_real_escape_string($dbLink, $instructorDepartment),
mysqli_real_escape_string($dbLink, $instructorStatement),
mysqli_real_escape_string($dbLink, $citation1),
mysqli_real_escape_string($dbLink, $citation2),
mysqli_real_escape_string($dbLink, $citation3),
mysqli_real_escape_string($dbLink, $citation4),
mysqli_real_escape_string($dbLink, $citation5),
mysqli_real_escape_string($dbLink, $citation6),
mysqli_real_escape_string($dbLink, $citation7),
mysqli_real_escape_string($dbLink, $citation8),
mysqli_real_escape_string($dbLink, $citation9),
mysqli_real_escape_string($dbLink, $citation10)
);
//echo "query = $query";
break;
//no, the item is not for course reserve, so do nothing
case "noReserve":
break;
}
//what material type was selected
switch($matType){
//////////////////////BEGIN BOOK INFO//////////////////////////////
case "book":
if($bookTitle == ""){
echo "<b><font color='red'>Please enter a book title.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($bookAuthor == ""){
echo "<b><font color='red'>Please enter a book author.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//$libemail = 'selectors.library@pratt.edu';
$libemail = 'wmcmilli@pratt.edu';
//Create the email body.
$today = date('m/d/Y');
$body .="<p><b>Date : </b>". $today."</p>\r\n";
$body .="<p><b>Name : </b>".$name."</p> \n";
$body .="<p><b>E-mail * : </b>".$email." </p>\n";
$body .="<p><b>PrattID : </b>".$prattID."</p> \n";
$body .="<p><b>Student, Faculty, Staff or Other * : </b>".$people." </p>\n\n\n";
$body .="<p><b>Department : </b>".$department."</p> \n";
$body .="<p><b>How does this item support the curriculum, research, and/or learning needs of the Institute? : </b>".$curriculum."</p> \n";
$body .="<p><b>Material Type * : </b>".$matType."</p> \n";
$body .="<p><b>Author(s)/Editor(s) : </b>".$bookAuthor."</p> \n";
$body .="<p><b>Title * : </b>".$bookTitle."</p> \n";
$body .="<p><b>Publisher : </b>".$bookPublisher."</p> \n";
$body .="<p><b>Year of Publication: </b>".$bookYear."</p> \n";
$body .="<p><b>Edition : </b>".$bookEdition."</p> \n";
$body .="<p><b>ISBN : </b>".$ISBN."</p> \n";
$body .="<p><b>Price : </b>".$bookPrice."</p> \n";
$body .="<p><b>Do you wish to be notified when the item arrives? </b>".$notify."</p> \n";
$query = sprintf("INSERT INTO purchase (timeStamp, name, email, phone, prattID, people, department, curriculum, matType, bookAuthor, bookTitle, bookPublisher, bookYear, bookEdition, ISBN, bookPrice, notify) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($dbLink, $timeStamp),
mysqli_real_escape_string($dbLink, $name),
mysqli_real_escape_string($dbLink, $email),
mysqli_real_escape_string($dbLink, $phone),
mysqli_real_escape_string($dbLink, $prattID),
mysqli_real_escape_string($dbLink, $people),
mysqli_real_escape_string($dbLink, $department),
mysqli_real_escape_string($dbLink, $curriculum),
mysqli_real_escape_string($dbLink, $matType),
mysqli_real_escape_string($dbLink, $bookAuthor),
mysqli_real_escape_string($dbLink, $bookTitle),
mysqli_real_escape_string($dbLink, $bookPublisher),
mysqli_real_escape_string($dbLink, $bookYear),
mysqli_real_escape_string($dbLink, $bookEdition),
mysqli_real_escape_string($dbLink, $ISBN),
mysqli_real_escape_string($dbLink, $bookPrice),
mysqli_real_escape_string($dbLink, $notify)
);
//echo "query = $query";
break;
//////////////////////END BOOK INFO//////////////////////////////
////////////////////BEGIN PERIODICAL INFO///////////////////////
case "periodical":
if($perTitle == ""){
echo "<b><font color='red'>Please enter a title.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//$libemail = 'selectors.library@pratt.edu';
$libemail = 'wmcmilli@pratt.edu';
//Create the email body.
$today = date('m/d/Y');
$body .="<p><b>Date : </b>". $today."</p>\r\n";
$body .="<p><b>Name : </b>".$name."</p> \n";
$body .="<p><b>E-mail * : </b>".$email." </p>\n";
$body .="<p><b>PrattID : </b>".$prattID."</p> \n";
$body .="<p><b>Student, Faculty, Staff or Other * : </b>".$people." </p>\n\n\n";
$body .="<p><b>Department : </b>".$department."</p> \n";
$body .="<p><b>How does this item support the curriculum, research, and/or learning needs of the Institute? : </b>".$curriculum."</p> \n";
$body .="<p><b>Material Type * : </b>".$matType."</p> \n";
$body .="<p><b>Title * : </b>".$perTitle."</p> \n";
$body .="<p><b>Publisher : </b>".$perPublisher."</p> \n";
$body .="<p><b>Frequency of Publication: </b>".$perFrequency."</p> \n";
$body .="<p><b>ISSN : </b>".$perISSN."</p> \n";
$body .="<p><b>Price : </b>".$perPrice."</p> \n";
$body .="<p><b>Do you wish to be notified when the item arrives? </b>".$notify."</p> \n";
$query = sprintf("INSERT INTO purchase (timeStamp, name, email, phone, prattID, people, department, curriculum, matType, perTitle, perPublisher, perFrequency, perISSN, perPrice, notify) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($dbLink, $timeStamp),
mysqli_real_escape_string($dbLink, $name),
mysqli_real_escape_string($dbLink, $email),
mysqli_real_escape_string($dbLink, $phone),
mysqli_real_escape_string($dbLink, $prattID),
mysqli_real_escape_string($dbLink, $people),
mysqli_real_escape_string($dbLink, $department),
mysqli_real_escape_string($dbLink, $curriculum),
mysqli_real_escape_string($dbLink, $matType),
mysqli_real_escape_string($dbLink, $perTitle),
mysqli_real_escape_string($dbLink, $perPublisher),
mysqli_real_escape_string($dbLink, $perFrequency),
mysqli_real_escape_string($dbLink, $perISSN),
mysqli_real_escape_string($dbLink, $perPrice),
mysqli_real_escape_string($dbLink, $notify)
);
//echo "query = $query";
break;
//////////////END PERIODICAL INFO//////////////////////
//////////////////BEGIN E-Resource INFO//////////////////
case "electronic":
if($erTitle == ""){
echo "<b><font color='red'>Please enter a title.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//$libemail = 'selectors.library@pratt.edu';
$libemail = 'wmcmilli@pratt.edu';
//Create the email body.
$today = date('m/d/Y');
$body .="<p><b>Date : </b>". $today."</p>\r\n";
$body .="<p><b>Name : </b>".$name."</p> \n";
$body .="<p><b>E-mail * : </b>".$email." </p>\n";
$body .="<p><b>PrattID : </b>".$prattID."</p> \n";
$body .="<p><b>Student, Faculty, Staff or Other * : </b>".$people." </p>\n\n\n";
$body .="<p><b>Department : </b>".$department."</p> \n";
$body .="<p><b>How does this item support the curriculum, research, and/or learning needs of the Institute? : </b>".$curriculum."</p> \n";
$body .="<p><b>Material Type * : </b>".$matType."</p> \n";
$body .="<p><b>Title * : </b>".$erTitle."</p> \n";
$body .="<p><b>Publisher : </b>".$erPublisher."</p> \n";
$body .="<p><b>Frequency of Publication: </b>".$erFrequency."</p> \n";
$body .="<p><b>ISSN : </b>".$erISSN."</p> \n";
$body .="<p><b>Price : </b>".$erPrice."</p> \n";
$body .="<p><b>Do you wish to be notified when the item arrives? </b>".$notify."</p> \n";
$query = sprintf("INSERT INTO purchase (timeStamp, name, email, phone, prattID, people, department, curriculum, matType, erTitle, erPublisher, erFrequency, erISSN, erPrice, notify) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($dbLink, $timeStamp),
mysqli_real_escape_string($dbLink, $name),
mysqli_real_escape_string($dbLink, $email),
mysqli_real_escape_string($dbLink, $phone),
mysqli_real_escape_string($dbLink, $prattID),
mysqli_real_escape_string($dbLink, $people),
mysqli_real_escape_string($dbLink, $department),
mysqli_real_escape_string($dbLink, $curriculum),
mysqli_real_escape_string($dbLink, $matType),
mysqli_real_escape_string($dbLink, $erTitle),
mysqli_real_escape_string($dbLink, $erPublisher),
mysqli_real_escape_string($dbLink, $erFrequency),
mysqli_real_escape_string($dbLink, $erISSN),
mysqli_real_escape_string($dbLink, $erPrice),
mysqli_real_escape_string($dbLink, $notify)
);
//echo "query = $query";
break;
/////////////////////END EResource INFO////////////////////
///////////////BEGIN VIDEO INFO/////////////////////////////
case "video":
if($videoTitle == ""){
echo "<b><font color='red'>Please enter a title.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
if($videoFormat == ""){
echo "<b><font color='red'>Please enter a format.</b></font><br/> Please click Back button on your browser to return to the previous page";
return;
}
//$libemail = 'selectors.library@pratt.edu';
$libemail = 'wmcmilli@pratt.edu';
//Create the email body.
$today = date('m/d/Y');
$body .="<p><b>Date : </b>". $today."</p>\r\n";
$body .="<p><b>Name : </b>".$name."</p> \n";
$body .="<p><b>E-mail * : </b>".$email." </p>\n";
$body .="<p><b>PrattID : </b>".$prattID."</p> \n";
$body .="<p><b>Student, Faculty, Staff or Other * : </b>".$people." </p>\n\n\n";
$body .="<p><b>Department : </b>".$department."</p> \n";
$body .="<p><b>How does this item support the curriculum, research, and/or learning needs of the Institute? : </b>".$curriculum."</p> \n";
$body .="<p><b>Material Type * : </b>".$matType."</p> \n";
$body .="<p><b>Title * : </b>".$videoTitle."</p> \n";
$body .="<p><b>Director : </b>".$videoDirector."</p> \n";
$body .="<p><b>Publisher : </b>".$videoPublisher."</p> \n";
$body .="<p><b>Format: </b>".$videoFormat."</p> \n";
$body .="<p><b>Year : </b>".$videoYear."</p> \n";
$body .="<p><b>Price : </b>".$videoPrice."</p> \n";
$body .="<p><b>Do you wish to be notified when the item arrives? </b>".$notify."</p> \n";
$query = sprintf("INSERT INTO purchase (timeStamp, name, email, phone, prattID, people, department, curriculum, matType, videoTitle, videoDirector, videoPublisher, videoFormat, videoYear, videoPrice, notify) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
mysqli_real_escape_string($dbLink, $timeStamp),
mysqli_real_escape_string($dbLink, $name),
mysqli_real_escape_string($dbLink, $email),
mysqli_real_escape_string($dbLink, $phone),
mysqli_real_escape_string($dbLink, $prattID),
mysqli_real_escape_string($dbLink, $people),
mysqli_real_escape_string($dbLink, $department),
mysqli_real_escape_string($dbLink, $curriculum),
mysqli_real_escape_string($dbLink, $matType),
mysqli_real_escape_string($dbLink, $videoTitle),
mysqli_real_escape_string($dbLink, $videoDirector),
mysqli_real_escape_string($dbLink, $videoPublisher),
mysqli_real_escape_string($dbLink, $videoFormat),
mysqli_real_escape_string($dbLink, $videoYear),
mysqli_real_escape_string($dbLink, $videoPrice),
mysqli_real_escape_string($dbLink, $notify)
);
//echo "query = $query";
break;
}
//send email
//First initialize internal variables for cleanliness and safety.
$address = '';
$key = '';
$value = '';
//$body = '';
$headers = '';
$RETURNPAGE="index.htm";
$ERRORPAGE="response/error.php";
$SUCCESSPAGE="response/success_general.php?email=$email";
$REPLY='';
$SUBJECT="Material Purchase Request";
//$FROM="<webmaster@libserv.ucmo.edu>";
//Create the headers, including the $FROM header.
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=us-ascii\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
//Final if block to see if the mail succeeded in going or if there was an error.
$libemail = 'wmcmilli@pratt.edu';
$adminemail = mail($libemail,$SUBJECT,$body,$headers);
//Confirmation email to requestor
if($email != ''){
$bodyrequest = "<p><b>This is an automatic message. PLEASE DO NOT REPLY THIS EMAIL.\n\nYour request has been submitted successfully. The following is your comment details: </b></p><br/>\n\n";
$bodyrequest .= $body;
$SUBJECTconfirm = "Material Purchase Request Confirmation";
$confirmemail = mail($email,$SUBJECTconfirm,$bodyrequest,$headers);
}else
$confirmemail = 1;
if($adminemail && $confirmemail){
$retreiveresult = mysqli_query($dbLink, $query) or die(mysqli_error($dbLink));
header("Location: $SUCCESSPAGE"); //redirect to success.php page
exit(0);
} else{
header("Location:$ERRORPAGE"); //redirect to error.php page
exit(1);
}
?>
</div><!-- close content div -->
</body><!-- close body-->
</html>