commit 5da39bbdba624e3274f0ad5b48f99362b8c6d4bd
parent 2a68de56aba446543e921c1de3c2cee02bcbfa7c
Author: John Charron <rm_rf_windows@yahoo.fr>
Date: Wed, 23 Feb 2011 11:05:10 +0100
Merge branch 'master' of https://github.com/jsmaniac/2011-m1s2-ter
Diffstat:
2 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/code/serveur/php/contact.php b/code/serveur/php/contact.php
@@ -1,5 +1,31 @@
<?php
session_start();
+
+$displayForm = true;
+
+if(isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message']))
+ if(!empty($_POST['email']) && !empty($_POST['subject']) && !empty($_POST['message']))
+ {
+ $from = $_POST['email'];
+ $subject = $_POST['subject'];
+ $header = 'From: '.$from . "\r\n" .
+ 'Reply-To: '.$from . "\r\n" .
+ 'X-Mailer: PHP/' . phpversion();
+ $dest = $EmailAddress;
+ $message = str_replace("\r\n","\n",$_POST['message']);
+
+ if(mail($dest,$subject,$message,$header))
+ {
+ $notif = "Votre email à été envoyé";
+ $displayForm = false;
+ }
+ else
+ $notif = "Une erreur s'est produite lors de l'envoi du message";
+ }
+ else
+ $notif = "Veuillez remplir tout les champs";
+
+
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -16,7 +42,50 @@ session_start();
<?php include("ressources/menu.html"); ?>
</div>
<div class="content">
- Le contenu.
+ if(isset($notif))
+ if($dspForm == true)
+ echo '<span class="warning">'.$notif.'</span>';
+ else
+ echo '<span class="notifOK">'.$notif.'</span>';
+
+ if($dspForm == true)
+ {
+ ?>
+ <form action="contact.php" method="POST">
+ <table class="formTbl1">
+ <tr>
+ <td>
+ <label for="email">Votre e-mail : </label>
+ </td>
+ <td>
+ <input type="text" id="email" name="email" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="sujet">Objet du mail : </label>
+ </td>
+ <td>
+ <input type="text" id="sujet" name="sujet" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="message">Votre message : </label>
+ </td>
+ <td>
+ <textarea class="txMessage" id="message" name="message"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <span class="btSubmit"><input type="submit" value="Envoyer le message" /></span>
+ </td>
+ </tr>
+ </table>
+ </form>
+ <?php
+ }
</div>
<div class="footer">
<?php include("ressources/footer.html"); ?>
diff --git a/code/serveur/php/login.php b/code/serveur/php/login.php
@@ -8,7 +8,7 @@ if(isset($_POST['loginpswd']) && !empty($_POST['loginpswd']))
if(isset($_GET['return']))
$location = $_GET['return'];
else
- $location = "contact.php";
+ $location = "index.php";
if(isset($_GET['d']) && $_GET['d'] == "true") {
session_destroy();