science-ation/schoolfeedback.php
2011-03-02 05:23:38 +00:00

46 lines
1.8 KiB
PHP

<?php
require_once('common.inc.php');
require_once('user.inc.php');
user_auth_required("teacher");
$schoolid=user_field_required("schools_id","user_edit.php?tab=school");
send_header("Feedback / Questions");
// load the school info
$q=mysql_query("SELECT * FROM schools WHERE id='$schoolid'");
echo mysql_error();
$school=mysql_fetch_object($q);
// send the e-mail if we're receiving a post
if(array_key_exists('feedbacktext', $_POST)){
$sh=user_load($_SESSION['users_id']);
$sha=account_load($_SESSION['accounts_id']);
$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.="Name: {$sh['firstname']} {$sh['lastname']}\n";
if($sh['phonework']) $body.="Phone (Work): {$sh['phonework']}\n";
if($sha['username']) $body.="Username: {$sha['username']}\n";
if($sha['email']) $body.="Email Address: {$sha['email']}\n";
$body.="\nFeedback:\n".stripslashes($_POST['feedbacktext'])."\n";
if($sha['email'])
$returnEmailAddress = $sh_email;
else
$returnEmailAddress = $config['fairmanageremail'];
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!");
echo "<form method=\"post\" action=\"schoolfeedback.php\">";
echo "<br><textarea name=\"feedbacktext\" rows=\"8\" cols=\"60\"></textarea><br />";
echo "<input type=\"submit\" value=\"".i18n("Send Feedback")."\">";
echo "</form>";
send_footer();
?>