Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Wysłanie formularza kontaktowego.
cykcykacz
post
Post #1





Grupa: Zarejestrowani
Postów: 550
Pomógł: 9
Dołączył: 29.05.2009
Skąd: Ostrów Wielkopolski

Ostrzeżenie: (0%)
-----


Skryp wysyłający:
  1. if (($_REQUEST['name'] == "")) {
  2. if(empty($_REQUEST['asunto'])) {
  3. }
  4. if ($_REQUEST['EMail'].length > 1){
  5. if ( ! preg_match('/^[a-z0-9_\.\-]+@[a-z0-9\.\-]+\.[a-z]{2,}$/i', $_REQUEST['EMail']) ) die ("Your mails format is not valid");
  6. }
  7. if ( preg_match("/!/", $_REQUEST['EMail'] ) ) die ("Your mail address is not valid");
  8.  
  9. if ( strstr($_REQUEST['EMail'], "\n") ) die ("Your mails format is not valid");
  10. $nowUrl = $_SERVER['HTTP_REFERER']; //woher kommt der aufruf
  11.  
  12.  
  13.  
  14. // SENDMAIL /////////////////////////////////////////////////////////////////
  15. /////////////////////////////////////////////////////////////////////////////
  16. if(empty($_REQUEST['asunto'])) {
  17. }
  18. $my_email = "karkonosze@promax.media.pl";
  19. $continue = "/";
  20. // This line prevents values being entered in a URL
  21. if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
  22. $message = "";
  23. // This line prevents a blank form being sent
  24.  
  25. while(list($key,$value) = each($_REQUEST)){
  26. if(!(empty($value))){$set=1;}
  27.  
  28. if((!($key == "name")) AND (!($key == "goto")) AND (!($key == "goto1")) AND (!($key == "goto2")) ){
  29. //$message = $message . "$key: $value\n";
  30. }
  31. }
  32.  
  33. $message = $message .
  34. "CONSULTA > " . $_REQUEST['asunto'] . "\n" .
  35. "-----------------------------------------------\n" .
  36. "Apellidos: " . $_REQUEST['Apellidos'] . "\n" .
  37. "Nombre: " . $_REQUEST['Nombre'] . "\n" .
  38. "email: " . $_REQUEST['EMail'] . "\n" .
  39. "Mensaje: " . $_REQUEST['mensaje']
  40. ;
  41.  
  42. if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
  43. //$message = $message . "-- \n";
  44. $message = stripslashes($message); // do not change name message - is used in leveltest
  45. $subject = "Web: CONSULTA > " . $_REQUEST['asunto'];
  46. $headers = "From: " . "web" . "\n" . "Return-Path: " . $_REQUEST['EMail'] . "\n" . "Reply-To: " . $_REQUEST['EMail'] . "\n";
  47. mail($my_email,$subject,$message, "From: " . $_REQUEST['EMail']);
  48.  
  49.  
  50.  
  51.  
  52. // BB.DD. ///////////////////////////////////////////////////////////////////
  53. /////////////////////////////////////////////////////////////////////////////
  54.  
  55. //$db = @mysql_connect("localhost","c_kipke","Ei6faash");
  56. $db = @mysql_connect("localhost","lexises_582e","v125w");
  57.  
  58. //if (!$db) {
  59. // echo "Your message has been sent.<br><br>Please use the back-button of your browser. <br><br>Thank you.\n";
  60. // exit;
  61. //}
  62.  
  63. //mysql_select_db("c_kipke_db_1",$db);
  64. mysql_select_db("lexises_1",$db);
  65.  
  66. $dat=date("Ymd");
  67. $Email = $_REQUEST['EMail'];
  68. $Name = $_REQUEST['Apellidos'] . ", " . $_REQUEST['Nombre'];
  69. $Asunto = $_REQUEST['asunto'];
  70. $Text = $message;
  71. $sql = "INSERT INTO ContactosViaForm (Date,Name,Email,Topic,Text) VALUES ('$dat','$Name','$Email','$Asunto','$Text')";
  72.  
  73. $result = mysql_query($sql,$db);
  74.  
  75.  
  76. // OK /// ///////////////////////////////////////////////////////////////////
  77. /////////////////////////////////////////////////////////////////////////////
  78.  
  79. header('Location:' . $_REQUEST['goto']);
  80.  
  81.  
  82. }


Formularz wysyłający:
Kod
                  <FORM action="consulta.php" method="post" name="consulta">
    
                  
    <h1><img src="datos/flecha_submenu.gif">Skontaktuj się z nami</h1>
    
    <p>Jesteśmy zadowoleni, mogąc pomóc Ci w wyborze kursu języka hiszpańskiego, który jest odpowiedni dla Ciebie. Jesteśmy tu, aby pomóc Ci w pełni wykorzystać możliwości nauki języka hiszpańskiego w Hiszpanii.</p>          
            
    <table width="100%" border="0" cellpadding="2" cellspacing="2" class="inscripcion_tabla">

            <tr>
              <td class="inscripcion_izq">Nazwisko:</td>
              <td><input type="text" name="Apellidos" size="32"></td>
            </tr>
            <tr>
              <td class="inscripcion_izq">Imię:</td>
              <td><input type="text" name="Nombre" size="32"></td>
            </tr>
            <tr>
              <td class="inscripcion_izq">E-mail:</td>
              <td><input type="text" name="EMail" size="32"></td>
            </tr>
            <tr>
              <td class="inscripcion_izq">Temat:</td>
              <td><select name="asunto">
                  <option selected value="Alojamiento">Zakwaterowanie</option>
                  <option value="Precios">Cena</option>
                  <option value="Cursos de Español">KURS HISZPAŃSKIEGO</option>
                  <option value="Español para el turismo">Hiszpański dla turystyki</option>
                  <option value="Inscripción">Rejestracja</option>
                  <option value="Actividades">Dodatkowe zajęcia</option>
                  <option value="Otros">Inne</option>
                </select></td>
            </tr>
            
            <tr>
              <td class="inscripcion_izq">Wiadomość:</td>
              <td><textarea name="mensaje" cols="50" rows="3"></textarea></td>
            </tr>
  
            
            
    </table>
          
          
          
          
          
          
            
<div class="inscripcion_separador"></div>
          
          
          <p align="center">
            <input type="HIDDEN" name="name" size="8" maxlength="20" value="" />
            <br>
            <input type="submit" value="Wyślij" name="Submit_Spanish" style="width:250px; margin-top:6px; margin-bottom:12px"><br>
            <a href="java script:document.consulta.reset();">Skasuj zawartość formularzu</a> <br>
            
            <!--<input type="HIDDEN" name="asunto" value="CONSULTA"><br> -->
            <input type="HIDDEN" name="goto" value="escuela_contactar_ok_pl.php">
          </p>
      
</form>


Klikam wyślij, nie waliduje ani nie wysyła.

Anyone help. (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 23:12