<?
$page = "support_email.php";
include "manager_header.php";

if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "main"; }


if($task == "cancel") {
header("Location: support.php");
exit();
}


if($task == "dosend") {


$email = $_POST['email'];
$issue = $_POST['issue'];
$priority = $_POST['priority'];
$sent_message = $_POST['message'];
$date = cdate("g:i A \o\\n D, M y", time());
$message = "$support_email1\n\n$support_email2 $user_info[u_id]\n$support_email3 $user_info[username]\n$support_email4 $email\n$support_email5 $_SERVER[REMOTE_ADDR]\n$support_email6 $date\n$support_email7\n";
$message .= stripslashes("$sent_message");

$headers = "From: $email\r\n";

if($email == "" | $sent_message == "") { 
 echo $head; 
 echo "
 <h2>$support_email30</h2>
 $support_email31<br><br><input type='button' class='button' value='$support_email32' onClick='history.go(-1);'>
 "; 
 echo $foot; 
 exit(); 
}

// SEND MAIL
mail("$admin_info[email]", "$support_email8 - $issue", $message, $headers);

echo $head;
echo "
<h2>$support_email9</h2>
$support_email10
<br><br>
<form action='support.php' method='POST'>
<input type='submit' class='button' value='$support_email11'>
</form>
";
echo $foot;
exit();
}





if($task == "main") {
echo $head;
echo "
<h2>$support_email12</h2>
$support_email13
<br><br>

<table cellpadding='0' cellspacing='0' class='form'>
<form action='support_email.php' method='POST'>
<tr>
<td class='form1'>$support_email14</td>
<td class='form2'>
<input type='text' class='text' name='email' value='$user_info[email]' size='25'>
</td>
</tr>
<tr>
<td class='form1'>$support_email15</td>
<td class='form2'>
<select name='issue'>
<option>$support_email16</option>
<option>$support_email17</option>
<option>$support_email18</option>
<option>$support_email19</option>
<option>$support_email20</option>
<option>$support_email21</option>
</select>
</td>
</tr>
<tr>
<td class='form1'>$support_email22</td>
<td class='form2'>
<select name='priority'>
<option>$support_email23</option>
<option>$support_email24</option>
<option SELECTED>$support_email25</option>
<option>$support_email26</option>
</select>
</td>
</tr>
<tr>
<td class='form1' colspan='2'>$support_email27<br><br><textarea name='message' rows='10' cols='70'></textarea></td>
</tr>
</table>

<br>

<table cellspacing='0' cellpadding='0'>
<tr>
<td><input type='submit' name='submit' class='button' value='$support_email28'></td>
<input type='hidden' name='task' value='dosend'>
</form>
<form action='support_email.php' method='POST'>
<td>&nbsp;<input type='submit' name='submit' class='button' value='$support_email29'></td>
<input type='hidden' name='task' value='cancel'>
</form>
</tr>
</table>
";
echo $foot;
}
?>