";
// Finally, send the e-mail
return mail($recip, $subject, $body, $header);
}
function ExhibitFileName($quesid) {
// This returns the name of the exhibit file for the passed question ID. Each question in the
// quiz_questions table has a unique ID. The image file is stored as 'ques' plus the ID number
// of the question (e.g. ques114.gif is question 114's GIF file exhibit).
// This returns the name of the file used as the exhibit file or an empty string if one does
// not exist. The exhibit file can be .gif, .jpg, or .png.
if (file_exists('/home/opticamp/exhibits/ques' . $quesid . '.gif')) {
return "ques$quesid.gif";
} else if (file_exists('/home/opticamp/exhibits/ques' . $quesid . '.jpg')) {
return "ques$quesid.jpg";
} else if (file_exists('/home/opticamp/exhibits/ques' . $quesid . '.png')) {
return "ques$quesid.png";
}
return ''; // Else, return an empty string
}
function WriteToLog($logtype, $logdetails) {
// Write to the log table with the info passed. Events such as logins,
// changes, signing up for tests,
// etc can be written to this log. Just a general use log to report site activity.
$logdetails = addslashes($logdetails);
mysql_query('INSERT INTO log (logtime, logtype, logdetails) ' .
"VALUES (now(), '$logtype', '$logdetails')");
// 13 Oct 2002 -- return the auto-increment ID number from the insert into the log table.
// This can be used to refer to this particular log entry and
// is used when there is a credit card transaction error.
return mysql_insert_id();
}
function WriteExhibit($quesid) {
// This writes the image link for the exhibit image associated with the current question.
// There may not be an image -- in this case, write nothing.
// 20 Aug 2002 -- This function is moved here as it is called in two or more scripts.
$fname = ExhibitFileName($quesid);
if (empty($fname)) { return; }
// Write the link to the image
print "
";
}
function PrintComment($txt) {
// 09 Nov 2003 -- Write an HTML comment with the passed text as the comment
print "\n\n";
}
?>