<?PHP
if(@$_REQUEST['form'] == "" || @$_REQUEST['registrarid'] == ""){
echo "<p>This page cannot be called directly.</p>";
exit();
}
if(@$_REQUEST['step'] != "two"){
ob_start();
if($_REQUEST['form'] == "agreement"){
include("trainingagreement.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "pdfagreement"){
include("trainingagreement.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "confirmation"){
include("trainingconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "pdfconfirmation"){
include("trainingconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "rescheduledconfirmation"){
include("rescheduledconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "pdfrescheduledconfirmation"){
include("rescheduledconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "reminderconfirmation"){
include("reminderconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "pdfreminderconfirmation"){
include("reminderconfirm.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "confirmation2"){
include("trainingconfirm2.php");
$to = $client_contact['email'].", ".$student_contact['email'].", ".$stbrep['stb_email'];
}elseif($_REQUEST['form'] == "po"){
include("purchaseorder.php");
$to = $vendor['vendoremail'];
}elseif($_REQUEST['form'] == "survey"){
include("studentsurvey.php");
$to = $student_contact['email'];
}elseif($_REQUEST['form'] == "invoice"){
include("invoice.php");
$to = $row_Recordset1['billemail']; //change this
}
ob_end_clean();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
<title>Send <?PHP echo $_REQUEST['form']; ?></title>
</head>
<body>
<form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="registrarid" value="<?PHP echo $_REQUEST['registrarid']; ?>">
<input type="hidden" name="form" value="<?PHP echo $_REQUEST['form']; ?>">
<input type="hidden" name="step" value="two">
<p>
Send <?PHP echo $_REQUEST['form']; ?> to: <input type="text" name="send_to" value="<?PHP echo $to; ?>" size="50"> (Example: email@yourdomain.com, email2@yourdomain.com)<br>
<input type="submit" name="submit_button" value="Send <?PHP echo $_REQUEST['form']; ?>">
</p>
</form>
</body>
</html>
<?PHP
exit();
}elseif(@$_REQUEST['step'] == "two"){
ob_start();
if($_REQUEST['form'] == "agreement"){
include("trainingagreement.php");
}elseif($_REQUEST['form'] == "pdfagreement"){
include("trainingagreement.php");
}elseif($_REQUEST['form'] == "confirmation"){
include("trainingconfirm.php");
}elseif($_REQUEST['form'] == "pdfconfirmation"){
include("trainingconfirm.php");
}elseif($_REQUEST['form'] == "rescheduledconfirmation"){
include("rescheduledconfirm.php");
}elseif($_REQUEST['form'] == "pdfrescheduledconfirmation"){
include("rescheduledconfirm.php");
}elseif($_REQUEST['form'] == "reminderconfirmation"){
include("reminderconfirm.php");
}elseif($_REQUEST['form'] == "pdfreminderconfirmation"){
include("reminderconfirm.php");
}elseif($_REQUEST['form'] == "confirmation2"){
include("trainingconfirm2.php");
}elseif($_REQUEST['form'] == "po"){
include("purchaseorder.php");
}elseif($_REQUEST['form'] == "survey"){
include("studentsurvey.php");
}elseif($_REQUEST['form'] == "invoice"){
include("invoice.php");
}
$message=ob_get_contents();
ob_end_clean();
$success = "Email sent successfully!";
$failure = "Failed to send email!!!";
if($_REQUEST['form'] == "agreement"){
$success = "Agreement sent successfully.";
$failure = "Failed to send agreement email!!";
$from = "registrar@domain.com";
$subject = "Training Agreement - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
}elseif($_REQUEST['form'] == "confirmation"){
$success = "Confirmation sent successfully.";
$failure = "Failed to send confirmation email!!";
$from = "registrar@domain.com";
$subject = "Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
}elseif($_REQUEST['form'] == "rescheduledconfirmation"){
$success = "Rescheduled Confirmation sent successfully.";
$failure = "Failed to send rescheduled confirmation email!!";
$from = "registrar@domain.com";
$subject = "Rescheduled Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
}elseif($_REQUEST['form'] == "reminderconfirmation"){
$success = "Reminder Confirmation sent successfully.";
$failure = "Failed to send reminder confirmation email!!";
$from = "registrar@domain.com";
$subject = "Reminder Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
}elseif($_REQUEST['form'] == "confirmation2"){
$success = "Confirmation sent successfully.";
$failure = "Failed to send confirmation email!!";
$from = "registrar@domain.com";
$subject = "Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
}elseif($_REQUEST['form'] == "po"){
$success = "Purchase order sent successfully.";
$failure = "Failed to send purchase order email!!";
$from = $stbrep['stb_email'];
$subject = "Purchase Order - " . $student_contact['lastname'] . " - " . $vendor['Company_Name'] . "";
}elseif($_REQUEST['form'] == "survey"){
$success = "Survey sent successfully.";
$failure = "Failed to send survey email!!";
$from = $stbrep['stb_email'];
$subject = "Survey - " . $student_contact['lastname'] . " - " . $vendor['Company_Name'] . "";
}elseif($_REQUEST['form'] == "invoice"){
$success = "Invoice sent successfully.";
$failure = "Failed to send invoice email!!";
$from = $row_Recordset1['stb_email'];
$subject = "Invoice - " . $row_Recordset1['invoicenumber'] . " - " . $row_Recordset1['studentlast'] . " - " . $row_Recordset1['coursecode'] . " - " . $row_Recordset1['coursename'] . "";
}
if ($_REQUEST['form'] == 'pdfconfirmation') {
$from = "registrar@domain.com";
$subject = "Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
$message = 'Attached you will find your confirmation and other pertinent details to your upcoming training event. If you have any questions regarding your enrollment, please call us toll free at 1.888.555.2121.<br /><br />
Thank you,<br /><br />
Education Services<br />
Company Name';
$success = "PDF confirmation sent successfully.";
include 'createpdf.php';
$results = true;
}
elseif ($_REQUEST['form'] == 'pdfrescheduledconfirmation') {
$from = "registrar@domain.com";
$subject = "Reschedule Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
$message = 'Attached you will find your reschedule confirmation and other pertinent details to your upcoming training event. If you have any questions regarding your enrollment, please call us toll free at 1.888.555.2121.<br /><br />
Thank you,<br /><br />
Education Services<br />
Company Name';
$success = "PDF Reschedule confirmation sent successfully.";
include 'createpdfreschedule.php';
$results = true;
}
elseif($_REQUEST['form'] == "pdfagreement"){
$success = "PDF Agreement sent successfully.";
$failure = "Failed to send agreement email!!";
$from = "registrar@domain.com";
$subject = "Training Agreement - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
$message = 'Attached you will find your agreement and other pertinent details to your upcoming training event. If you have any questions regarding your enrollment, please call us toll free at 1.888.555.2121.<br /><br />
Thank you,<br /><br />
Education Services<br />
Company Name';
include 'createpdfagreement.php';
$results = true;
}
elseif ($_REQUEST['form'] == 'pdfreminderconfirmation') {
$from = "registrar@domain.com";
$subject = "Confirmation - " . $student_contact['lastname'] . " - " . $course['course_num'] . " - " . $course['ctitle'] . "";
$message = 'Attached you will find your reminder confirmation and other pertinent details to your upcoming training event. If you have any questions regarding your enrollment, please call us toll free at 1.888.555.2121.<br /><br />
Thank you,<br /><br />
Education Services<br />
Company Name';
$success = "PDF Reminder confirmation sent successfully.";
include 'createpdfreminder.php';
$results = true;
}
else {
$send_to = $_POST['send_to'];
$message = str_replace("../invoice.css", "[URL unfurl="true"]http://www.domain.com/invoice.css",[/URL] $message);
$message = preg_replace("/\.?\.?\/images\/logo_hi-res_sm.gif/", "[URL unfurl="true"]http://www.domain.com/images/logo_hi-res_sm.gif",[/URL] $message);
//$message = str_replace("/images/logo_hi-res_sm.gif", "[URL unfurl="true"]http://www.domain.com/images/logo_hi-res_sm.gif",[/URL] $message);
$message = str_replace("/images/gray_dot.gif", "[URL unfurl="true"]http://www.domain.com/images/gray_dot.gif",[/URL] $message);
$message = str_replace("/images/shared_dot_clear.gif", "[URL unfurl="true"]http://www.domain.com/images/shared_dot_clear.gif",[/URL] $message);
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$send_to;
// Additional headers
$headers .= "\r\n";
$headers .= 'From: ' .$from. "\r\n";
$results = @mail($send_to, $subject, $message, $headers);
}
if($results){
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
<title>Message Sent</title>
</head>
<body>
<p><a href="dashboard-new.php">Dashboard</a> | <a href="registrar_new.php?registrarid=<?PHP echo $_REQUEST['registrarid']; ?>">Registrar</a></p>
<p><?PHP echo $success; ?></p>
<p>Message sent to: <?PHP echo $send_to; ?></p>
<p>The following message was sent:</p>
<hr>
<?PHP echo $message; ?>
</body>
</html>
<?PHP
}else{
echo $failure;
}
exit();
}
?>
<p>This page cannot be called directly.</p>