+ Rispondi alla Discussione
Risultati da 1 a 8 di 8

Discussione: modulo contatti sito web

  1. #1
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito modulo contatti sito web

    ciao, ho creato un piccolo sito con magix web designer 5, l'ho pubblicato su altervista, mi serviva un modulo contatti e ho trovato questo codice, non ho capito dove devo inserire la mia mail, e come cambiare colore delle scritte del modulo visto che lo sfondo dove va a collocarsi il modulo è nero.
    Questo è il codice del modulo:

    <form method="post" action="invia.php"><INPUT NAME="op" TYPE="hidden" VALUE="send">
    <table>
    <tr>
    <td><p>Nome:</p></td>
    <td>
    <input name="name" type="text" size="30" maxlength="150">
    </td>
    </tr>
    <tr>
    <td><p>E-mail:</p></td>
    <td>
    <input name="email" type="text" size="30" maxlength="150">
    </td>
    </tr>
    <tr>
    <td valign="top"><p>Messaggio:</p></td>
    <td><textarea name="message" cols="35" rows="6"></textarea></td>
    </tr>
    <tr><td></td> <td><input name="submit" type="submit" value="Invia"></td></tr>
    </table>
    </form>
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

  2. #2
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito

    e questo il codice del file allegato:

    <?php
    if (isset($_POST["op"]) && ($_POST["op"]=="send")) {
    /******** START OF CONFIG SECTION *******/
    $sendto = "";
    $subject = "Website Contact Enquiry";
    // Select if you want to check form for standard spam text
    $SpamCheck = "Y"; // Y or N
    $SpamReplaceText = "*content removed*";
    // Error message prited if spam form attack found
    $SpamErrorMessage = "<p align=\"center\"><font color=\"red\">Malicious code content detected.
    </font><br><b>Your IP Number of <b>".getenv("REMOTE_ADDR")."</b> has been logged.</b></p>";
    /******** END OF CONFIG SECTION *******/
    $name = $HTTP_POST_VARS['name'];
    $email = $HTTP_POST_VARS['email'];
    $message = $HTTP_POST_VARS['message'];
    $headers = "From: $email\n";
    $headers . "MIME-Version: 1.0\n"
    . "Content-Transfer-Encoding: 7bit\n"
    . "Content-type: text/html; charset = \"iso-8859-1\";\n\n";
    if ($SpamCheck == "Y") {
    // Check for Website URL's in the form input boxes as if we block website URLs from the form,
    // then this will stop the spammers wastignt ime sending emails
    if (preg_match("/http/i", "$name")) {echo "$SpamErrorMessage"; exit();}
    if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();}
    if (preg_match("/http/i", "$message")) {echo "$SpamErrorMessage"; exit();}
    // Patterm match search to strip out the invalid charcaters, this prevents the mail injection spammer
    $pattern = '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'; // build the pattern match string
    $name = preg_replace($pattern, "", $name);
    $email = preg_replace($pattern, "", $email);
    $message = preg_replace($pattern, "", $message);
    // Check for the injected headers from the spammer attempt
    // This will replace the injection attempt text with the string you have set in the above config section
    $find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i");
    $email = preg_replace($find, "$SpamReplaceText", $email);
    $name = preg_replace($find, "$SpamReplaceText", $name);
    $message = preg_replace($find, "$SpamReplaceText", $message);
    // Check to see if the fields contain any content we want to ban
    if(stristr($name, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();}
    if(stristr($message, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();}
    // Do a check on the send email and subject text
    if(stristr($sendto, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();}
    if(stristr($subject, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();}
    }
    // Build the email body text
    $emailcontent = "
    -----------------------------------------------------------------------------
    WEBSITE CONTACT ENQUIRY
    -----------------------------------------------------------------------------
    Name: $name
    Email: $email
    Message: $message
    _______________________________________
    End of Email
    ";
    // Check the email address enmtered matches the standard email address format
    if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $email)) {
    echo "<p>It appears you entered an invalid email address</p><p><a href='javascript: history.go(-1)'>Click here to go back</a>.</p>";
    }
    elseif (!trim($name)) {
    echo "<p>Please go back and enter a Name</p><p><a href='javascript: history.go(-1)'>Click here to go back</a>.</p>";
    }
    elseif (!trim($message)) {
    echo "<p>Please go back and type a Message</p><p><a href='javascript: history.go(-1)'>Click here to go back</a>.</p>";
    }
    elseif (!trim($email)) {
    echo "<p>Please go back and enter an Email</p><p><a href='javascript: history.go(-1)'>Click here to go back</a>.</p>";
    }
    // Sends out the email or will output the error message
    elseif (mail($sendto, $subject, $emailcontent, $headers)) {
    echo "<br><br><p><b>Thank You $name</b></p><p>We will be in touch as soon as possible.</p>";
    }
    }
    else {
    ?>
    <p align="center">Uno o piu campi vuoti</p>
    <?php } ?>
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

  3. #3
    Data Registrazione
    Apr 09
    Località
    Italia
    Messaggi
    1,395

    Predefinito

    Per cambiare il colore delle etichette del modulo, bisogna specificare il codice del colore in esadecimale. prendo per esempio la tua prima etichetta (Nome) e prendo a modello il colore bianco. Diventerà:

    Codice HTML:
    <td><p style="text-color: #FFFFFF">Nome:</p></td>
    Ho aggiunto style="text-color: #FFFFFF" al tag <p>.
    Per quanto riguarda la tua e-mail, la devi inserire in $sendto, alla quarta riga del codice sorgente. Io vedo:

    Codice:
    $sendto = "";
    E deve essere reso come:

    Codice PHP:
    $sendto "indirizzo_email" 
    Ultima modifica di orrhack; 26-06-11 alle 22:20
    Orrhack - Webmaster/Amministratore/Server Manager di Science Server Enhancing Platform
    "Non scholae sed vitae discimus." (Lucius Annaeus Seneca); "Diventa ciò che sei." (Friedrich Wilhelm Nietzsche) ; "Work, Finish, Publish." (Michael Faraday).

  4. #4
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito

    grazie per l'intervento, sono riuscito a cambiare il colore dello sfondo, ho messo il mio indirizzo in mail to, ma poi mi da un errore, allora siccome il codice sopra è troppo complicato per me per ora, ho trovato un altro codice più semplice, che funziona, questo è il codice del modulo:

    <form name="form1" id="form1" method="post" action="invio.php">
    Nome</p><input type="text" name="nome" /></p>
    Telefono</p><input type="text" name="tel" /></p>
    Email</p><input type="text" name="email" /></p>
    Messaggio</p><input type="text" name="mess" /></p>
    <input name="Invia" type="submit" value="Invia" />
    </form>
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

  5. #5
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito

    e questo il file allegato:


    <?php


    $mailto = "TUO_INDIRIZZO";
    $subject = "OGGETTO DELLA MAIL";
    $redirect = "URL_PAGINA";


    foreach($HTTP_POST_VARS as $key => $value) {

    $message .= $key . ': ' . $value;
    $message .= "\n";

    }
    if (@mail($mailto, $subject, $message)) {

    header("Location: $redirect");
    } else {

    echo('
    Errore</p>');
    }
    ?>
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

  6. #6
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito

    funziona male però, mi arriva la mail senza il corpo del messaggio e il mittente è Apache (sarà il server altervista).
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

  7. #7
    Data Registrazione
    Apr 09
    Località
    Italia
    Messaggi
    1,395

    Predefinito

    Nel codice c'è qualcosa che non mi convince. Prova a sostituirlo con questo contenente modifiche che ho apportato:

    Codice PHP:
    <?php

    $mailto 
    "TUO_INDIRIZZO";
    $subject "OGGETTO DELLA MAIL";
    $redirect "URL_PAGINA";
    $message $_POST['mess'];
    $fromemail $_POST['email'];
    $headers "From: ".$fromemail;

    mail($mailto$subject$message$headers);

    header("Location: $redirect");

    ?>
    Orrhack - Webmaster/Amministratore/Server Manager di Science Server Enhancing Platform
    "Non scholae sed vitae discimus." (Lucius Annaeus Seneca); "Diventa ciò che sei." (Friedrich Wilhelm Nietzsche) ; "Work, Finish, Publish." (Michael Faraday).

  8. #8
    Data Registrazione
    Feb 07
    Località
    Brescia provincia
    Messaggi
    3,330

    Predefinito

    bravissimo orrhack funziona bene ora, grazie mille.
    la mia nuova bestiolina: Asus P5Q-E, Core 2 duo E8400 - 4 giga ram Corsair - 500 gb hd Western Digital sata II + 1 hd 1 Tera - Windows xp pro - Windows 7 Ultimate - dvd/ram Pioneer - Ati 4850 - case Enermax Chakra Monstaer fan - Lcd LG 22" Wide - casse Creative 2.1 iscritto al forum di CM dal 08/2005

+ Rispondi alla Discussione

Discussioni Simili

  1. Risposte: 0
    Ultimo Messaggio: 21-12-10, 11:29
  2. modulo RAM che funziona saltuariamente
    Di quark nel forum Hardware
    Risposte: 11
    Ultimo Messaggio: 18-07-09, 18:44
  3. Modulo sondaggio per sito web
    Di fermat nel forum Reti & Internet
    Risposte: 0
    Ultimo Messaggio: 09-01-08, 13:41
  4. Modulo Karajan
    Di Damolition nel forum Hardware
    Risposte: 0
    Ultimo Messaggio: 21-11-07, 00:10
  5. scrivere un modulo supporto periferiche, come?
    Di bubilinux nel forum Hardware / Software
    Risposte: 4
    Ultimo Messaggio: 31-08-07, 13:40

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  • Il codice BB è Attivato
  • Le faccine sono Attivato
  • Il codice [IMG] è Attivato
  • Il codice HTML è Disattivato