contact.php (3151B)
1 <?php 2 require_once("ressources/strings.inc"); 3 session_start(); 4 5 $displayForm = true; 6 $emailaddress = ""; 7 $mailfile = "mails.txt"; 8 $msg = null; 9 10 function writemail($filename,$email,$subject,$message) 11 { 12 $file = fopen($filename,"a+"); 13 14 if($file != -1) { 15 fprintf($file,"%s\n%s\n%s\n\n---------------------\n\n\n",$email,$subject,$message); 16 } 17 else 18 die($strings['err_contact_open_mailfile']); 19 20 fclose($file); 21 } 22 23 24 if(isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])) 25 if(!empty($_POST['email']) && !empty($_POST['subject']) && !empty($_POST['message'])) 26 { 27 $from = $_POST['email']; 28 $subject = $_POST['subject']; 29 $header = 'From: '.$from . "\r\n" . 30 'Reply-To: '.$from . "\r\n" . 31 'X-Mailer: PHP/' . phpversion(); 32 $dest = $emailaddress; 33 $message = str_replace("\r\n","\n",$_POST['message']); 34 35 writemail($mailfile,$from,$subject,$message); 36 37 $displayForm = false; 38 39 /*if(mail($dest,$subject,$message,$header)) 40 { 41 $msg = $strings['ok_msg_sent']; 42 43 } 44 else 45 $msg = "Une erreur s'est produite lors de l'envoi du message";*/ 46 47 $msg = $strings['ok_contact_msg_sent']; 48 } 49 else 50 $msg = $strings['err_contact_fill_all']; 51 52 53 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 54 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> 55 <head> 56 <title>PtiClic sous Android™ - Version Alpha - Contact</title> 57 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 58 <link rel="stylesheet" href="ressources/simple.css" /> 59 </head> 60 <body> 61 <?php include("ressources/menu.inc"); ?> 62 <div class="content contact"> 63 <?php include("ressources/showmsg.inc"); ?> 64 65 <h2>Contact</h2> 66 67 <?php 68 if($msg != null) 69 if($displayForm == true) 70 echo '<span class="message warning">'.htmlspecialchars($msg).'</span>'; 71 else 72 echo '<span class="message success">'.htmlspecialchars($msg).'</span>'; 73 74 if($displayForm == true) 75 { // Fin sous le <form> ci-dessous 76 ?> 77 <p> 78 Vous souhaitez signaler un défaut dans l'application, ou bien vous avez des remarques, des suggestions ?<br /> 79 Faites-nous-en part en nous envoyant un message : 80 </p> 81 <form action="contact.php" method="POST"> 82 <table> 83 <tr> 84 <td> 85 <label for="email">Votre mail : </label> 86 </td> 87 <td> 88 <input type="text" id="email" name="email" /> 89 </td> 90 </tr> 91 <tr> 92 <td> 93 <label for="subject">Objet : </label> 94 </td> 95 <td> 96 <input type="text" id="subject" name="subject" /> 97 </td> 98 </tr> 99 <tr> 100 <td> 101 <label for="message">Message : </label> 102 </td> 103 <td> 104 <textarea class="txMessage" id="message" name="message"></textarea> 105 </td> 106 </tr> 107 <tr> 108 <td> 109 110 </td> 111 <td> 112 <span class="btSubmit"><input type="submit" value="Envoyer le message" /></span> 113 </td> 114 </tr> 115 </table> 116 </form> 117 <?php 118 } // Fin de if($displayForm == true) 119 ?> 120 </div> 121 <?php include("ressources/footer.inc"); ?> 122 </body> 123 </html>