2010-06-15 16:57:50 +00:00
< ? php
require_once ( 'common.inc.php' );
require_once ( 'user.inc.php' );
2010-10-14 19:42:20 +00:00
user_auth_required ( " teacher " );
$schoolid = user_field_required ( " schools_id " , " user_edit.php?tab=school " );
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
send_header ( " Feedback / Questions " );
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
// load the school info
$q = mysql_query ( " SELECT * FROM schools WHERE id=' $schoolid ' " );
echo mysql_error ();
$school = mysql_fetch_object ( $q );
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
// send the e-mail if we're receiving a post
if ( array_key_exists ( 'feedbacktext' , $_POST )){
2011-03-02 05:23:38 +00:00
$sh = user_load ( $_SESSION [ 'users_id' ]);
$sha = account_load ( $_SESSION [ 'accounts_id' ]);
2010-10-14 19:42:20 +00:00
$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 " ;
2011-03-02 05:23:38 +00:00
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 " ;
2010-10-14 19:42:20 +00:00
$body .= " \n Feedback: \n " . stripslashes ( $_POST [ 'feedbacktext' ]) . " \n " ;
2011-03-02 05:23:38 +00:00
if ( $sha [ 'email' ])
$returnEmailAddress = $sh_email ;
else
$returnEmailAddress = $config [ 'fairmanageremail' ];
2010-10-14 19:42:20 +00:00
mail ( $config [ 'fairmanageremail' ], " School Feedback " , $body , " From: " . $returnEmailAddress . " \n Reply-To: " . $returnEmailAddress . " \n Return-Path: " . $returnEmailAddress );
echo happy_ ( " Your feedback has been sent " );
}
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
// 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> " ;
2010-06-15 16:57:50 +00:00
2010-10-14 19:42:20 +00:00
send_footer ();
2010-06-15 16:57:50 +00:00
?>