Hai incluso il codice php dentro <? qui codice php ?> ....?
Così:
Codice PHP:
<?
//controllo antihackers
if(count($_POST)) {
foreach(array('surname','giudizio','email','name') as $key) $_POST[$key] = strip_tags($_POST[$key]);
if(!is_secure($_POST)) { die("Asta la vista Hacker");}
//end antihackers
# This section sends an email to you when
# the form is used
// Your email address (for copies to be sent to you)
$emailto = "eurosalute@altervista.org";
// Your email subject text
$esubject = "Un Giudizio è stato inviato(Poll)";
// The email text for copies sent to you
$emailtext = "
$_POST[name] $_POST[surname] ha usato il form Poll. Indirizzo email usato $_POST[email]
Il Giudizio è il seguente:
$_POST[giudizio]
";
# This sends the email to you
@mail("$emailto", $esubject, $emailtext, "From: $emailto");
# This section sends to the recipients
// Target page after successful submission
$thankyoupage = "thankyou.html";
# After successful processing, the thank you page
header("Location: $thankyoupage");
exit;
}
# Don't change anything below
function is_secure($ar) {
$reg = "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
if(!is_array($ar)) { return preg_match($reg,$ar);}
$incoming = array_values_recursive($ar);
foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
return true;
}
function array_values_recursive($array) {
$arrayValues = array();
foreach ($array as $key=>$value) {
if (is_scalar($value) || is_resource($value)) {
$arrayValues[] = $value;
$arrayValues[] = $key;
}
elseif (is_array($value)) {
$arrayValues[] = $key;
$arrayValues = array_merge($arrayValues, array_values_recursive($value));
}
}
return $arrayValues;
}
?>
Ovviamente sostituisci l'email con la tua:
$emailto = "eurosalute@altervista.org";
************************************************** ***
Funziona perfettamente!!!
Potete provare il form per il voto o giudizio qui:
http://eurosalute.altervista.org/too...izio_poll.html
Codici html e php usati.....definitivi.
File giudizio_poll.html :
Codice HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Esprimi un tuo giudizio</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta name="rating" content="General">
<meta http-equiv="Content-Language" content="it">
<meta name="copyright" content="Copyright 2010, eurosalute.altervista.org">
<meta name="resource-type" content="document">
<meta name="Submission" CONTENT="http://eurosalute.altervista.org">
<meta name="Author" CONTENT="Webmaster">
<meta name="Subject" CONTENT="">
<meta name="ROBOTS" content="ALL">
<meta name="revisit-after" content="10 days">
<link href="http://classifieds.yourclickspaid.com/style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/windowstatus0.js"></script>
<script language="javascript">
<!--
function reset() {
document.poll.name.value="";
document.poll.email.value="";
document.poll.surname.value="";
document.poll.giudizio.value="";
}
function validate() {
if (document.poll.name.value.length==0) {
alert("Per favore inserisci il tuo nome");
return false;
}
/*
if (document.poll.email.value.length==0) {
alert("Per favore inserisci il tuo indirizzo email");
return false;
}
*/
if (document.poll.surname.value.length==0) {
alert("Per favore inserisci il tuo cognome");
return false;
}
if (document.poll.giudizio.value.length==0) {
alert("Per favore inserisci un giudizio");
return false;
}
document.poll.submit()
return true;
}
//-->
</script>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<div class="containertable">
<table id="header" width="450" cellpadding="0" cellspacing="0" align="center">
<tr valign="top"><td align="center" valign="middle" bgcolor="" class="">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td height="50" align="center">
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'it'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</td></tr></table>
</td></tr>
<tr valign="top"><td align="center" valign="middle" bgcolor="" class="blueheadline">
Esprimi un tuo giudizio
</td></tr>
<tr valign="top">
<td valign="middle" align="center" class="box">
<p>Completa il form qui per esprimere un tuo giudizio sul sito.</p>
<form name="poll" action="poll.php" method="post" onsubmit="return checkfields()">
<div align="center" class="">
<center>
<table border="0" cellpadding="10" cellspacing="0">
<tr>
<td> *Tuo Nome:</td>
<td>
<input size="30" name="name" maxlength="45">
</td>
</tr>
<tr>
<td> *Tuo Cognome:</td>
<td>
<input size="30" name="surname" maxlength="45">
</td>
</tr>
<tr>
<td colspan="2">
<p align="center">Se inserisci il tuo indirizzo email, ti sarà inviata una email contenente il giudizio che hai espresso.
<br><small>Se non inserisci l'indirizzo email, non ti sarà inviata nessuna email.</small>
</td>
</tr>
<tr>
<td> Tuo Indirizzo email:</td>
<td>
<input size="30" name="email" maxlength="45">
</td>
</tr>
<tr>
<td colspan="2">
<p align="center">Per favore inserisci un tuo giudizio:</td>
</tr>
<tr>
<td>*Tuo Giudizio:</td>
<td>
<input size="30" name="giudizio" maxlength="45">
</td>
</tr>
<tr>
<td colspan="2">
<p align="center">
L'email che invierai conterrà il tuo nome, cognome, indirizzo email(se inserito) e giudizio. <br>
<input onclick="validate();" type="button" value="Clicca qui per inviare">
</td>
</tr>
</table>
</center>
</div>
</form>
</td>
</tr>
<tr valign="top">
<td valign="middle" align="center">
<small>Powered by eurosalute.altervista.org</small>
</td>
</tr>
</table>
</div>
</body>
</html>
File poll.php :
Codice PHP:
<?
//controllo antihackers
if(count($_POST)) {
foreach(array('surname','giudizio','email','name') as $key) $_POST[$key] = strip_tags($_POST[$key]);
if(!is_secure($_POST)) { die("Asta la vista Hacker");}
//end antihackers
# This section sends an email to you when
# the form is used
// Your email address (for copies to be sent to you)
$emailto = "eurosalute@altervista.org";
// Your email subject text
$esubject = "Un Giudizio è stato inviato(Poll)";
// The email text for copies sent to you
$emailtext = "
$_POST[name] $_POST[surname] ha usato il form Poll.
Indirizzo email usato $_POST[email]
Il Giudizio è il seguente:
$_POST[giudizio]
";
# This sends the email to you
@mail("$emailto", $esubject, $emailtext, "From: $emailto");
# This section sends to the recipients
// Target page after successful submission
$thankyoupage = "thankyou_poll.html";
if ($_POST[email]) {
// Change the subject text below to suit
$twebsite = "eurosalute.altervista.org";
$tsubject = "Hai espresso un giudizio per il sito web $twebsite";
// Change the text below for the email
// Don't change any "$_POST[value]" items
$ttext = "
Ciao,
Hai appena espresso un giudizio per il sito web:
http://$twebsite
Il tuo Nome : $_POST[name]
Il tuo Cognome : $_POST[surname]
Il tuo indirizzo email : $_POST[email]
Hai espresso il seguente giudizio:
$_POST[giudizio]
Grazie!
";
# This email the poll to the address submitted
@mail("$_POST[email]", $tsubject, $ttext, "FROM: $emailto");
}
# After successful processing, the thank you page
header("Location: $thankyoupage");
exit;
}
# Don't change anything below
function is_secure($ar) {
$reg = "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
if(!is_array($ar)) { return preg_match($reg,$ar);}
$incoming = array_values_recursive($ar);
foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
return true;
}
function array_values_recursive($array) {
$arrayValues = array();
foreach ($array as $key=>$value) {
if (is_scalar($value) || is_resource($value)) {
$arrayValues[] = $value;
$arrayValues[] = $key;
}
elseif (is_array($value)) {
$arrayValues[] = $key;
$arrayValues = array_merge($arrayValues, array_values_recursive($value));
}
}
return $arrayValues;
}
?>
PROVATO .... FUNZIONA PERFETTAMENTE!!!