<?php

session_start();
//$user_type='d';
if (!($user_type=='d' || $user_type=='c'))
{
	//header("Location: NoteErrorPage.php");
	if (isset($body) && isset($quest))
	{
	print "unauthorized";
	}
	print "kay";
	print isset($body);
	print isset($quest);
}
else
{
?>
<HTML>
<HEAD>
   <TITLE>GPA New Frequently Asked Question</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" BACKGROUND="ZUNRBKGD.GIF">
<IMG SRC="ZUNRHDR.GIF" HEIGHT=41 WIDTH=482>

<?php
   mail($to,$subject,$quest."\n\n".$body);

   if (isset($quest) && isset($body))
   {
      $dbh = mysql_connect (mysql, andromeda, gradinfo);

      //insert quest and body into database
      mysql_select_db (AndromedaGradInfo_DB, $dbh);
      mysql_query("INSERT INTO andromeda_faq (question, answer) VALUES ('".$quest."','".$body."')", $dbh);
      print "Message sent, faq updated";
   }
   else
   {
   print "<P>You forgot something!</P>";
   }
}
?>
