<?php


//envoi dui mail			
$sendmail=FALSE;
if (isset ($_POST['action']) && $_POST['action']=="Envoyer"){

	$header = 'From: '.$_POST['repto'].'' . "\r\n" .
     'Reply-To: '.$_POST['repto'].'' . "\r\n" .
     'X-Mailer: PHP/' . phpversion();


//          $header = "From: ". $_POST['repto'] . " <" . $_POST['repto'] . ">\r\n"; //optional headerfields
	
          if (mail("support-ent@insa-toulouse.fr","[Support ENT] [Guest] : ".$_POST['sujet'], $_POST['desc'],$header)){
		  		$sendmail=TRUE;
		  }

	

}
			
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Support ENT</title>

<SCRIPT LANGUAGE="JavaScript">
/* On cre une fonction de verification */
function verifForm(formulaire)
{
	if((formulaire.repto.value == "")||(formulaire.sujet.value == "")||(formulaire.desc.value == "")) {
		if(formulaire.repto.value == "")
			alert('Veuillez saisir une adresse de réponse'); 
		if(formulaire.sujet.value == "")
			alert('Veuillez saisir un sujet');
		if(formulaire.desc.value == "") 
			alert('Veuillez saisir une description');
	}else{
		formulaire.submit(); /*tout est rempli on envoi le formulaire */
	}
}
</SCRIPT>
<style type="text/css">

.Style1 {font-family: Arial, Helvetica, sans-serif;font-size : 0.9em;color:#69686d}
.Style2 {color:#4736B6;font-size:1.4em;font-weight:bold}
.Style3 {font-family: Arial, Helvetica, sans-serif;}

</style>
</head>
<body>
<div align="center" class="Style1">
<?php
if ($sendmail){
echo ("<div>Votre message a bien &eacute;t&eacute; envoy&eacute;. Une r&eacute;ponse vous sera transmise sur votre adresse : ". $_POST['repto']."<br><a href=\"supportguest.php\">Retour au formulaire</a> </div>");

}else{
?>

<form method="POST" name="myform">
<table width="500" border="0" cellpadding="0" cellspacing="2">
  <tr>
    <td height="26" colspan="2"><div align="left">
      <div class="Style2"><strong>Demande de support sur l'ENT</strong></div>
      <p><span class="Style1">Ce formulaire est <u>r&eacute;serv&eacute; aux probl&egrave;mes techniques</u>, merci de fournir le maximum de d&eacute;tails </span></p>
      <p><span class="Style1">Pour un <b>certificat de scolarit&eacute;</b>, faites votre demande via <b>scolar@insa-toulouse.fr</b></span></p>
      <p><span class="Style1">Pour une <b>note</b>, contactez <b>le service scolarit&eacute; de votre d&eacute;partement</b></span></p>
      <p><span class="Style1"><b>Si vous n'arrivez pas &agrave; vous connnecter &agrave; votre messagerie Insa, merci de renseigner un mail alternatif</b></span></p>
      </div></td>
  </tr>
  <tr>
    <td NOWRAP><div align="left">Ad mail de retour : </div></td>
    <td><div align="left"><input type="text" name="repto"/></div></td>
  </tr>
  <tr>
    <td><div align="left">Sujet : </div></td>
    <td><div align="left"><input name="sujet" type="text" id="sujet" size="30" /></div></td>
  </tr>
  <tr valign="top">
    <td valign="top"><div align="left" >
Description :
    </div></td>
    <td valign="top"><textarea name="desc" cols="50" rows="8"></textarea></td>
  </tr>
  <tr>
    <td colspan="2" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" valign="top"><div align="center">
	<input type="hidden" name="action" value="Envoyer">
      <input type="button" value="Envoyer" onClick="verifForm(this.form)"/>
      &nbsp;
      <input type="reset" name="Submit2" value="Annuler" />
    </div></td>
  </tr>
</table>
</form>
<?php
}
?>
</div>

</body></html>
