//----------------------------------------------------------
//-----PRELIMINAIRES
//----------------------------------------------------------
//-----PRELIMINAIRES
@include_once("config.php");
connect();
//-----VARIABLES
$idrub=4;
DJS_recupvar('beware','');
//----------------------------------------------------------
//-----CONTENU
//----------------------------------------------------------
if(isset($_POST['submit']))
{
//-----CAS 1 : FORMULAIRE
if(empty($_POST['nom']) || empty($_POST['adresse']) || empty($_POST['code']) || empty($_POST['ville']) || empty($_POST['fixe']) || empty($_POST['email']))
$beware='
Les champs marqués d\'une * sont obligatoires.
';
//-----CAS 2 : ENVOI
else
{
//-----Constitution du Body
$body='
NOM PRENOM
'.$_POST['nom'].' '.$_POST['prenom'].'
ADRESSE
'.$_POST['adresse'].'
'.$_POST['code'].' '.$_POST['ville'].'
TELEPHONE
Fixe : '.$_POST['fixe']. ( !empty($_POST['portable']) ? '
Portable : '.$_POST['portable'] : '' ) .'
EMAIL
'.$_POST['email'] . ( isset($_POST['geo']) ? '
SECTEUR GEOGRAPHIQUE
'.implode(' / ', $_POST['geo']) : '' ) .
( isset($_POST['typebien']) ? '
TYPE DE BIEN
'.implode(' / ', $_POST['typebien']) : '' ) .
( isset($_POST['nb']) ? '
NOMBRE DE CHAMBRES
'.implode(' / ', $_POST['nb']) : '' ) .
( !empty($_POST['mini']) || !empty($_POST['maxi']) ? '
BUDGET'.
( !empty($_POST['mini']) ? '
Mini : '.$_POST['mini'] : '' ) .
( !empty($_POST['maxi']) ? '
Maxi : '.$_POST['maxi'] : '' ) : '') .
( !empty($_POST['mini']) || !empty($_POST['maxi']) ? '
MESSAGE
'.$_POST['message'] : '' ) .
( isset($_POST['age']) ? '
AGE DU PROJET
'.$_POST['age'] : '' ) ;
//-----Envoi de l'email ou message d'erreur
$mail1=mail('julie.tetard@free.fr','Contact du site TMS',$body,'From:'.$_POST['email']);
$mail2=mail('seguier.terroirmeretsoleil@wanadoo.fr','Contact du site TMS',$body,'From:'.$_POST['email']);
$mail3=mail('terroirmeretsoleil@wanadoo.fr','Contact du site TMS',$body,'From:'.$_POST['email']);
if($mail1===FALSE || $mail2===FALSE || $mail3===FALSE)
$print='Ce service est momentanément indisponible.
Pour plus d\'information vous pouvez nous contacter directement.';
else
$print='Votre demande de contact a bien été envoyée, vous recevrez une réponse très prochainement.';
}
}
if(empty($print))
{
//-----INFOS
DJS_recupvar('nom','');
DJS_recupvar('prenom','');
DJS_recupvar('adresse','');
DJS_recupvar('code','');
DJS_recupvar('ville','');
DJS_recupvar('fixe','');
DJS_recupvar('portable','');
DJS_recupvar('email','');
DJS_recupvar('geo',array());
DJS_recupvar('typebien',array());
DJS_recupvar('nb',array());
DJS_recupvar('mini','');
DJS_recupvar('maxi','');
DJS_recupvar('message','');
DJS_recupvar('age','');
foreach(array('nom','prenom','adresse','code','ville','fixe','portable','email','mini','maxi') as $varname)
${$varname}=htmlentities(${$varname});
$onload='document.tms.nom.focus();';
$print='
';
}
//----------------------------------------------------------
//-----AFFICHAGE
//----------------------------------------------------------
//-----HEADER
@include_once('header.php');
//-----PRINT
echo $print;
//-----FOOTER
@include_once('footer.php');
?>