forked from science-ation/science-ation
54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php
|
|
require_once('common.inc.php');
|
|
require_once('user.inc.php');
|
|
|
|
|
|
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
|
{
|
|
$title = i18n("Feedback / Questions");
|
|
send_header($title, array("School Home" => "schoolaccess.php"));
|
|
|
|
// load the school info
|
|
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'");
|
|
echo mysql_error();
|
|
$school=mysql_fetch_object($q);
|
|
|
|
if($school->sciencehead_uid > 0)
|
|
$sh = user_load_by_uid($school->sciencehead_uid);
|
|
else
|
|
$sh = array();
|
|
$sh_email = ($sh['email'] != '' && $sh['email'][0] != '*') ? $sh['email'] : '';
|
|
|
|
// send the e-mail if we're receiving a post
|
|
if(array_key_exists('feedbacktext', $_POST)){
|
|
$body="";
|
|
$body.=date("r")."\n";
|
|
$body.=$_SERVER['REMOTE_ADDR']." (".$_SERVER['REMOTE_HOST'].")\n";
|
|
$body.="School ID: $school->id\n";
|
|
$body.="School Name: $school->school\n";
|
|
if($sh['name']) $body.="Science Teacher: {$sh['name']}\n";
|
|
if($sh['phonework']) $body.="Science Teacher Phone: {$sh['phonework']}\n";
|
|
if($sh_email) $body.="Science Teacher Email: $sh_email\n";
|
|
$body.="\nFeedback:\n".stripslashes($_POST['feedbacktext'])."\n";
|
|
$returnEmailAddress = $sh_email;
|
|
mail($config['fairmanageremail'],"School Feedback",$body,"From: ". $returnEmailAddress."\nReply-To: ".$returnEmailAddress."\nReturn-Path: ".$returnEmailAddress);
|
|
echo happy_("Your feedback has been sent");
|
|
}
|
|
|
|
// draw the feedback form
|
|
echo i18n("We are always welcome to any feedback (both positive and constructive criticism!), or any questions you may have. Please use the following form to communicate with the science fair committee!");
|
|
if($sh_email != '') {
|
|
echo "<form method=POST action=\"schoolfeedback.php\">";
|
|
echo "<br><textarea name=feedbacktext rows=8 cols=60></textarea><br>";
|
|
echo "<input type=submit value=\"Send Feedback\">";
|
|
echo "</form>";
|
|
}else{
|
|
echo error("Feedback is disabled until a science teacher email address is entered above");
|
|
}
|
|
|
|
send_footer();
|
|
}else{
|
|
header('Location: schoolaccess.php');
|
|
}
|
|
?>
|