2010-06-15 16:57:50 +00:00
< ? php
require_once ( 'common.inc.php' );
require_once ( 'user.inc.php' );
if ( $_SESSION [ 'schoolid' ] && $_SESSION [ 'schoolaccesscode' ])
{
$title = i18n ( " Feedback / Questions " );
2010-06-16 17:50:12 +00:00
send_header ( $title , array ( " School Home " => " schoolaccess.php " ));
2010-06-15 16:57:50 +00:00
// 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 .= " \n Feedback: \n " . stripslashes ( $_POST [ 'feedbacktext' ]) . " \n " ;
$returnEmailAddress = $sh_email ;
mail ( $config [ 'fairmanageremail' ], " School Feedback " , $body , " From: " . $returnEmailAddress . " \n Reply-To: " . $returnEmailAddress . " \n Return-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' );
}
?>