file mail.php
codice:
<?php
if(isset($_POST['submitform']))
{
//ELIMINO CARATTERI HTML E METTO IL VALORE PASSATO PER POST NELLE VARIABILI
$nome = strip_tags($_POST['fullname']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$subject = strip_tags($_POST['subject']);
$message = strip_tags($_POST['message']);
//SE IL CAMPO INPUT NON CONTIENE NULLA
if((trim($nome) == "")
OR (trim($email) == "")
OR (!@ereg("@",$email))
OR (trim($message) == ""))
{
Print "X Email non inviata
- Controlla i campi con l'asterisco
- Controlla l'indirizzo email";
}
else
{
//Dati per invio Email
$oggi = date("j F Y G:i"); // STAMPO LA DATA E L'ORA DI QUANDO E' STATA INVIATA L'EMAIL
$ip = "$_SERVER[REMOTE_ADDR]"; // STAMPO L'IP DI CHI MANDA L'EMAIL
$browser = "$_SERVER[HTTP_USER_AGENT]"; // STAMPO IL BROWSER CHE UTILIZZA L'UTENTE
$utente = "sappy88@hotmail.com";
$soggetto = "Modulo proveniente dal sito www.altavaldiforfora.it";
//INVIO EFFETTIVO DELL'EMAIL
$body = "Ciao Tuo nome, \n ti hanno contattato trami il modulo contatta di Altavaldiforfora \n\n ";
$body .= "Nome : $nome \n Email : $email \n Tel : $phone \n Oggetto : $subject \n Messaggio : $message \n\n";
$body .= "Email inviata il $oggi \n da IP : $ip \n Con Browser : $browser \n\n";
$body .= "Un Sistema by Exitpeople.com";
mail("$utente","$soggetto","$body");
Print"L'email è stata inviata con successo, l'amministratore del sito si impegnerà a rispondere nel più breve tempo possibile.";
}
}
?>
porzione di codice in file index.html
codice:
<div class="wrapper col1">
<div id="footer">
<div id="contactform">
<h2>Why Not Contact Us Today !</h2>
<form action="mail.php" method="post">
<fieldset>
<legend>Contact Form</legend>
<label for="fullname">Name:
<input id="fullname" name="fullname" type="text" value="" />
</label>
<label for="email" class="margin">Email:
<input id="email" name="email" type="text" value="" />
</label>
<label for="phone">Telephone:
<input id="phone" name="phone" type="text" value="" />
</label>
<label for="subject" class="margin">Subject:
<input id="subject" name="subject" type="text" value="" />
</label>
<label for="message">Message:
<textarea id="message" name="message" cols="80" rows="8"></textarea>
</label>
<input id="submitform" name="submitform" type="submit" value="Submit" />
<input id="resetform" name="resetform" type="reset" value="Reset" />
</p>
</fieldset>
</form>
</div>