X favore mi aiutate a cercare l'errore?
Ho fatto 1 script x inviare mail dal mio sito, ma però nn cambia mai "pagina", ovvero la funzione switch, almeno in locale, nn funziona.
inoltre nei form nn invia il valore action.
NOTA: è stato diviso in intern ed in extern cioè i modi per inviare mail (dipende "dall'architettura" del mio sito, cioè dipende se uno l'ha lanciato dal menu e che quindi deve reindirizzare al frame o se è stato aperto in un altro modo)
[code:1:270be8f9ce]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Sles.it</title>
</head>
<?php
$php_self = $_SERVER["PHP_SELF"];
global $php_self , $action;
function form_intern() {
global $php_self , $action;
echo"Da qui potete scrivermi. Leggerò solo le e-mail inviate attraverso questo form."
. "<FORM ACTION=\"$php_self\">"
. "<p style=\"margin-top: -2; margin-bottom: -2\">&nbsp;</p>"
. "<p style=\"margin-top: -2; margin-bottom: -2\">E-mail:<input type=\"text\" name=\"email\" size=\"20\"></p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\">Nome:<input type=\"text\" name=\"nome\" size=\"20\"></p>"
. "<p style=\"margin-top: 6; margin-bottom: 6\">Testo:</p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\"><textarea rows=\"6\" name=\"testo\" cols=\"48\"></textarea></p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\">"
. "<imput type=\"hidden\" name=\"action\" value=\"send_intern\"></p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\" align=\"center\"><input type=\"submit\" value=\"invia\" name=\"invia\">&nbsp;&nbsp;&q uot;
. "<input type=\"reset\" value=\"Reimposta\" name=\"Reimposta\"></p>"
. "</form>";
};
function form_extern() {
global $php_self , $action;
echo"Da qui potete scrivermi. Leggerò solo le e-mail inviate attraverso questo form."
. "<FORM ACTION=\"$php_self\">"
. "<p style=\"margin-top: -2; margin-bottom: -2\">&nbsp;</p>"
. "<p style=\"margin-top: -2; margin-bottom: -2\">E-mail:<input type=\"text\" name=\"email\" size=\"20\"></p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\">Nome:<input type=\"text\" name=\"nome\" size=\"20\"></p>"
. "<p style=\"margin-top: 6; margin-bottom: 6\">Testo:</p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\"><textarea rows=\"6\" name=\"testo\" cols=\"48\"></textarea></p>"
. "<p style=\"margin-top: 2; margin-bottom: 2\">&nbsp;</p>"
. "<imput type=\"hidden\" name=\"action\" value=\"send_extern\">"
. "<p style=\"margin-top: 2; margin-bottom: 2\" align=\"center\"><input type=\"submit\" value=\"invia\" name=\"invia\">&nbsp;&nbsp;&q uot;
. "<input type=\"reset\" value=\"Reimposta\" name=\"Reimposta\"></p>"
. "</form>";
};
function testo_ok_intern() {
global $php_self , $action;
echo"<script language=\"JavaScript\">"
. "<!--"
. "defaultStatus = \"Sles.it\""
. "//-->"
. "</script>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottoottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"><font color=\"#0033FF\" size=\"7\">E-MAIL "
. " INVIATA </font></p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"><a href=\"site_index_frame.php\">Clicca qui</a>"
. "per tornare all'home page</p>"
."";
};
function testo_ok_extern() {
global $php_self , $action;
echo"<script language=\"JavaScript\">"
. "<!--"
. "defaultStatus = \"Sles.it\""
. "//-->"
. "</script>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"><font color=\"#0033FF\" size=\"7\">E-MAIL "
. " INVIATA </font></p>"
. ""
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\">&nbsp;</p>"
. "<p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"><a href=\"javascript:window.close()\ ">Clicca qui</a>"
. "per chiudere la finestra</p>"
."";
};
function send_intern() {
global $php_self , $action;
$date = date("d/m/Y H:i:s");
$testo_new = stripslashes($Testo);
unset($Invia);
$check[1] = $testo_new;
$check[2] = $email;
$check[3] = $nome;
$email_count = str_word_count($email);
$nome_count = str_word_count($nome);
if ($check[1] != "" || $check[2] != "" || $check[3] != "") {
if ($nome_count <= 2 || $email_count <= 4) {
$testo_email = "Messaggio inviato il ".$date." da ".$nome.", ".$email."/n/n
".$testo_new."";
mail("webmaster@sles.it", "Da Sles.it",$testo_email);
testo_ok_intern();
}
else {
echo "ERRORE! Alcuni campi non sono validi. <a href=\"javascript:history.back()\ "> Clicca qui per tornare indietro </a>";
};
}
else {
echo "ERRORE! Alcuni campi non sono compilati. TUTTI I CAMPI SONO OBBLIGATORI. <a href=\"javascript:history.back()\ "> Clicca qui per tornare indietro </a>";
};
};
function send_extern() {
global $php_self , $action;
$date = date("d/m/Y H:i:s");
$testo_new = stripslashes($Testo);
unset($Invia);
$check[1] = $testo_new;
$check[2] = $email;
$check[3] = $nome;
$email_count = str_word_count($email);
$nome_count = str_word_count($nome);
if ($check[1] != "" || $check[2] != "" || $check[3] != "") {
if ($nome_count <= 2 || $email_count <= 4) {
$testo_email = "Messaggio inviato il ".$date." da ".$nome.", ".$email."/n/n
".$testo_new."";
mail("webmaster@sles.it", "Da Sles.it",$testo_email);
testo_ok_extern();
if ($test = TRUE)
}
else {
echo "ERRORE! Alcuni campi non sono validi. <a href=\"javascript:history.back()\ "> Clicca qui per tornare indietro </a>";
};
}
else {
echo "ERRORE! Alcuni campi non sono compilati. TUTTI I CAMPI SONO OBBLIGATORI. <a href=\"javascript:history.back()\ "> Clicca qui per tornare indietro </a>";
};
};
switch ($action) {
default:
form_intern(); break;
case "form_intern":
form_intern(); break;
case "form_extern":
form_extern(); break;
case "send_intern":
send_intern(); break;
case "send_extern":
send_extern(); break;
};
?>
</html>[/code:1:270be8f9ce]
Regole di scrittura
Non puoi creare nuove discussioni
Non puoi rispondere ai messaggi
Non puoi inserire allegati.
Non puoi modificare i tuoi messaggi
Regole del forum