problema array
-
-
-
provato. niente da fare, non cambia nulla..
ora spiego l'infittimento del mistero..il guest permette di decidere quanti messaggi visualizzare per pagina.
io l'avevo settato a 5.
arrivata al 6° mess, quandi a pag 2.. la mail di destinazione diventava quella del mess di pag 2 .
adesso ho messo un messaggio per pagina.. e ognuno riceve la sua mail regolarmente!!!
ovviamente non è una soluzione, ma magari a qualcuno viene in mente da cosa può dipendere.. -
-
ok ma è lunghetto..
index:<?php $filename = "config.php"; if (!file_exists($filename)) { ?> <script language="JavaScript" type="text/javascript"> location.href="installa.php"; </script> <?php } else { $file10 = fopen("bannati.php", "r"); $dimensione10 = filesize("bannati.php"); $contenuto10 = fread($file10, $dimensione10); $ex = explode(" ", $contenuto10); for ($x=0; $x<=count($ex); $x++) { if ($ex[$x] == $_SERVER['REMOTE_ADDR']) { header("location: admin/bannato.php"); } else { } } include("config.php"); $file = "mess.php"; $apertura = fopen($file,'r+'); $dimensione = filesize($file); $contenuto = @fread($apertura, $dimensione); $capo = chr(13); $controllo = explode($capo, $contenuto); $bha = count($controllo); $totale = "0"; for ($messaggio = "0"; $messaggio < $bha; $messaggio++) { $messaggi = $controllo[$messaggio]; $array = explode(", ", $messaggi); if ($approva == "Si" AND $array[8] == "0") { } elseif ($array[1] != "") { $totale++; } } $chiusura = fclose($apertura); $divisione = $totale/$per_pagina; $virgola = explode(".", $divisione); $pagine = $virgola[0]+1; if ($pagine == 1) { $scritta = "1 pag"; } else { $scritta = "$pagine pag"; } if ($totale < $per_pagina) { $precedente = "<< pagina precedente"; $successiva = "pagina successiva >>"; } else { } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="skin/<?php echo $skin; ?>" type="text/css" rel="stylesheet"> <title><?php echo "$guestbook"; ?></title> <style type="text/css"> body { background-color: #e8e8e8; } form#contact{width:320px !important;width /**/:350px; height:100px !important; height /**/:100px; margin: 0;padding: 15px 15px 10px; background:#ECECEC } .Stile1 { font-size: 12px; font-family: Tahoma; color: #666666; background:#ECECEC; border: 1px solid #003399; } .Stile5 { font-family: Tahoma; font-size: 10px; color: #cccccc; } } .Stile5 a { color: #cccccc; text-decoration: none; font-size: 10px; } .Stile5 a:hover { color: #0099ff; text-decoration: none; } .Stile6{ font-family: Tahoma; font-size: 12px; font-weight: bold; color: #666666; } } .Stile6 a { color: #666666; text-decoration: none; font-weight: bold; font-size: 12px; } .Stile6 a:hover { color: #0099ff; text-decoration: none; font-weight: bold; } .Stile7 {font-family: Tahoma color: #666666; font-size: 12px; } </style> </head> <body style="margin-left: 0, margin-right: 0"> <div align="center"><span class="Stile7">Ci sono un totale di <?php echo "$totale" ?> messaggi nel guestbook, in <?php echo "$scritta"; ?> </span><br> <br> <table width="100%" border="0"> <tr class="main" align="center"> <td width="100%"><font class="scritte"><b>Messaggi</b></font></td> </tr> </table> <?php if ($pag == 1 OR !$pag) { $pagina = 0; } else { $pagina = $pag-1; } $ultimo_mess = $pagina*$per_pagina; if ($pagina == 0) { $ultima_pag = $per_pagina*1; } else { $ultima_pag = $per_pagina*$pag; } // Gestione link pagina \\ if (!$pag) { $precedente = "<font color=\"#003399\"><< precedente</font>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $successiva = "<a href=\"$PHP_SELF?pag=2\">successiva >></a>"; } } else { if ($pag == 2) { $precedente = "<a href=\"$PHP_SELF\"><< precedente</a>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $successiva = "<a href=\"$PHP_SELF?pag=3\">successiva >></a>"; } } else { // Se non è la pag 2 \\ $prec = $pag-1; $precedente = "<a href=\"$PHP_SELF?pag=$prec\"><< precedente</a>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $succ = $pag+1; $successiva = "<a href=\"$PHP_SELF?pag=$succ\">successiva >></a>"; } } } for ($messaggio = $ultimo_mess; $messaggio < $ultima_pag; $messaggio++) { $messaggi = $controllo[$messaggio]; $array = explode(", ", $messaggi); if ($array[1] == "") { } else { if ($approva == "Si" AND $array[6] == "0") { } else { ?> <script language="JavaScript" type="text/javascript"> //function apri() { //window.open('mail.php?mail= <?php echo "$array[4]"; ?>', 'Invia', 'toolbar,width=550,height=450,left=200,top=100,resizable=no'); //}\\ function apri() { var w = 500; var h = 400; var l = Math.floor((screen.width-w)/2); var t = Math.floor((screen.height-h)/2); window.open("mail.php?mail= <?php echo "$array[4]"; ?>", "Invia","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l); } //--> function smiley(code) { var testo = document.form.testo.value; this.code = code; document.form.testo.value = testo + code; } </script> <?php if ($array[4] == "") { $mail = ""; } else { $mail = "<a href=\"javascript:apri();\" title=\"Invia una e-mail a $array[0]\"><img src=\"img/email.gif\" title=\"Invia una e-mail a $array[0]\" border=\"0\" alt=\"\"></a>"; } $array[0] = str_replace("%&", ",", $array[0]); $array[1] = str_replace("%&", ",", $array[1]); $array[4] = str_replace("%&", ",", $array[4]); //$result =$array[4];\\ //echo $result.'<br>';\\ $array[0] = str_replace("<", "<", $array[0]); $array[0] = str_replace(">", ">", $array[0]); $array[1] = str_replace(";:;", "<", $array[1]); $array[1] = str_replace(":;:", ">", $array[1]); $array[1] = wordwrap($array[1],13,"\n",1); $array[1] = ereg_replace("(((http|ftp|https)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?","<a href=\"http://\\0\" target=\"".$target."\_blank\">\\0</a>", $array[1]); $array[1] = stripslashes($array[1]); echo "<table width=\"100%\" border=\"0\"> <tr> <td width=\"100%\" valign=\"top\"><b>$array[0]: </b>$array[1] $mail<br> ore $array[3] del $array[2]</td> </tr> </table>"; } } } ?> <br> <table width="100%" border="0"> <tr> <td class="Stile6" width="50%" align="right"><?php echo "$precedente" ?></td> <td class="Stile6" width="50%" align="left"><?php echo "$successiva" ?></td> </tr> </table><br> <form id="contact" method="post" action="scrivi.php" name="form"> <table width="100%" border="0" align="center"> <tr> <td height="20" align="center"><input name="autore" type="text" class="Stile1" value="Nome" size="16" maxlength="12"></td> </tr> <tr> <td height="20" align="center"><input name="testo" type="text" class="Stile1" value="Messaggio" size="16" maxlength="<?php echo $massimo; ?>"></td> </tr> <tr> <td height="20" align="center"><input name="mail" type="text" class="Stile1" value="Email" size="16"></td> </tr> </table> <table width="100%" border="0" align="center"> <tr> <td align="center"><?php $smiley = "smiley/smiley.txt"; $apri = fopen($smiley, 'r+'); $grandezza = filesize($smiley); $leggi = fread($apri, $grandezza); $capo = chr(13); $controllo = explode(" - ", $leggi); $parole = "smiley/parole.txt"; $apria = fopen($parole, 'r+'); $grandezzaa = filesize($parole); $leggia = fread($apria, $grandezzaa); $controlloa = explode(" - ", $leggia); foreach($controllo as $limi) { $ciao = explode(" ", $limi); if ($ciao[0] == "") { } else { $faccina .= "<img alt=\"\" src=smiley/$ciao[0].gif title=$ciao[1] style=cursor:pointer onClick=smiley(' $ciao[1]')>"; } } ?> <table width="100%" border="0"> <tr> <td width="100%" align="center"><?php echo "$faccina"; ?></td> </tr> </table> </td> </tr> <tr> <td align="center"><input type="submit" name="invia" value="Invia"></td> </tr> </table></form> <div align="center" class="Stile5"><br> <span class="Stile5"><a href="admin/index.php" target="rightFrame">Admin</a> </span></div> </div> </body> </html> <?php } ?>mail.php:
<?php include ("config.php"); $file10 = fopen("bannati.php", "r"); $dimensione10 = filesize("bannati.php"); $contenuto10 = fread($file10, $dimensione10); $ex = explode(" ", $contenuto10); for ($x=0; $x<=count($ex); $x++) { if ($ex[$x] == $_SERVER['REMOTE_ADDR']) { header("location: admin/bannato.php"); exit(); //evito di andare avanti con lo script } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="skin/<?php echo $skin; ?>" type="text/css" rel="stylesheet"> <title>Scrivi una mail</title> <style type="text/css"> .Stile1 { font-size: 12px; font-family: Tahoma; color: #666666; } .Stile3 { font-size: 12px; font-family: Tahoma; color: #666666; background:#ECECEC; border: 1px solid #003399; } body { background-color: #e8e8e8; } .Stile2 {color: #ECE9D8} </style> </head> <body style="margin-left: 0"> <?php if (!$_POST['testo']) { ?> <form method="post" action="<?php echo "mail.php?mail=$mail"; ?>" name="form"><div align="center"> <p><font class="title"><span class="Stile1">Scrivi una mail</span></font><br> <br> <span class="Stile1">Tutti i campi sono obbligatori</span><br> <br> </p> <table width="400" border="0" align="center"> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Oggetto</b></font></td> </tr> <tr> <td height="20" align="center" width="100%"><input name="oggetto" type="text" class="Stile3" size="30"></td> </tr> </table> <span class="Stile2"></span> <table width="400" border="0" align="center"> <tr class="main"> <td width="50%" align="center"><font class="Stile1"><b>Nome</b></font></td> <td width="50%" align="center"><font class="Stile1"><b>Tua mail</b></font></td> </tr> <tr> <td height="20" align="center"><input name="autore" type="text" class="Stile3"></td> <td height="20" align="center"><input name="email" type="text" class="Stile3"></td> </tr> </table> <table width="400" border="0" align="center"> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Messaggio</b></font></td> </tr> <tr> <td height="20" align="center"><textarea name="testo" cols="50" rows="6" class="Stile3"></textarea></td> </tr> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Conferma</b></font></td> </tr> <tr> <td align="center"><input name="invia" type="submit" class="Stile1" value="Invia mail"></td> </tr> </table></div></form> <?php } else { $autore = $_POST['autore']; $testo = $_POST['testo']; $email = $_POST['email']; $oggetto = $_POST['oggetto']; if (trim($autore) == "" OR trim($testo) == "" OR trim($email) == "" OR trim($oggetto) == "") { header("location: mail.php?mail=$mail"); exit(); //evito di andare avanti con lo script } mail($mail, $oggetto, $testo, "From: $autore - $email"); //$result =mail($mail, $oggetto, $testo, "From: $autore - $email");\\ //echo $result.'<br>';\\ ?> <div align="center"><font class="title"><?php echo "$guestbook"; ?></font><br> <br> <span class="Stile1">E-mail inviata con sucesso a <?php echo "$mail"; ?> . Grazie</span></div> <?php $chiusura = fclose($file10); } ?> </body> </html> -
guarda ho letto le pagine e l'errore che ho trovato è proprio quello che non viene settata la variabile $mail in mail.php prova così
<?php if (!$_POST['testo']) { $url=$_SERVER['php_self']; $mail=$_GET['mail']; ?> <form method="post" action="<?php echo "$url"; ?>" name="form"><div align="center"> <p><font class="title"><span class="Stile1">Scrivi una mail</span></font><br> <br> <span class="Stile1">Tutti i campi sono obbligatori</span><br> <br> </p> <table width="400" border="0" align="center"> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Oggetto</b></font></td> </tr> <tr> <td height="20" align="center" width="100%"><input name="oggetto" type="text" class="Stile3" size="30"></td> </tr> </table> <span class="Stile2"></span> <table width="400" border="0" align="center"> <tr class="main"> <td width="50%" align="center"><font class="Stile1"><b>Nome</b></font></td> <td width="50%" align="center"><font class="Stile1"><b>Tua mail</b></font></td> </tr> <tr> <td height="20" align="center"><input name="autore" type="text" class="Stile3"></td> <td height="20" align="center"><input name="email" type="text" class="Stile3"></td> </tr> </table> <table width="400" border="0" align="center"> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Messaggio</b></font></td> </tr> <tr> <td height="20" align="center"><textarea name="testo" cols="50" rows="6" class="Stile3"></textarea></td> </tr> <tr class="main"> <td width="100%" align="center"><font class="Stile1"><b>Conferma</b></font></td> </tr> <tr> <td align="center"><input name="invia" type="submit" class="Stile1" value="Invia mail"></td> </tr> </table></div></form> <?php } else { $autore = $_POST['autore']; $testo = $_POST['testo']; $email = $_POST['email']; $oggetto = $_POST['oggetto']; if (trim($autore) == "" OR trim($testo) == "" OR trim($email) == "" OR trim($oggetto) == "") { header("location: mail.php?mail=$mail"); exit(); //evito di andare avanti con lo script } mail($mail, $oggetto, $testo, "From: $autore - $email"); //$result =mail($mail, $oggetto, $testo, "From: $autore - $email");\\ //echo $result.'<br>';\\ ?> <div align="center"><font class="title"><?php echo "$guestbook"; ?></font><br> <br>E-mail inviata con sucesso. Grazie</div> <?php echo "$mail"; ?> </body> </html> -
-
-
questo è il file shout.php funziona l'ho provato in locale
<?php $filename = "config.php"; if (!file_exists($filename)) { ?> <script language="JavaScript" type="text/javascript"> location.href="installa.php"; </script> <?php } else { $file10 = fopen("bannati.php", "r"); $dimensione10 = filesize("bannati.php"); $contenuto10 = fread($file10, $dimensione10); $ex = explode(" ", $contenuto10); for ($x=0; $x<=count($ex); $x++) { if ($ex[$x] == $_SERVER['REMOTE_ADDR']) { header("location: admin/bannato.php"); } else { } } include("config.php"); $file = "mess.php"; $apertura = fopen($file,'r+'); $dimensione = filesize($file); $contenuto = @fread($apertura, $dimensione); $capo = chr(13); $controllo = explode($capo, $contenuto); $bha = count($controllo); $totale = "0"; for ($messaggio = "0"; $messaggio < $bha; $messaggio++) { $messaggi = $controllo[$messaggio]; $array = explode(", ", $messaggi); if ($approva == "Si" AND $array[8] == "0") { } elseif ($array[1] != "") { $totale++; } } $chiusura = fclose($apertura); $divisione = $totale/$per_pagina; $virgola = explode(".", $divisione); $pagine = $virgola[0]+1; if ($pagine == 1) { $scritta = "1 pag"; } else { $scritta = "$pagine pag"; } if ($totale < $per_pagina) { $precedente = "<< pagina precedente"; $successiva = "pagina successiva >>"; } else { } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="skin/<?php echo $skin; ?>" type="text/css" rel="stylesheet"> <title><?php echo "$guestbook"; ?></title> <style type="text/css"> <!-- body { background-color: #e8e8e8; } form#contact{width:320px !important;width /**/:350px; height:100px !important; height /**/:100px; margin: 0;padding: 15px 15px 10px; background:#ECECEC } .Stile1 { font-size: 12px; font-family: Tahoma; color: #666666; background:#ECECEC; border: 1px solid #003399; } .Stile5 { font-family: Tahoma; font-size: 10px; color: #cccccc; } } .Stile5 a { color: #cccccc; text-decoration: none; font-size: 10px; } .Stile5 a:hover { color: #0099ff; text-decoration: none; } .Stile6{ font-family: Tahoma; font-size: 12px; font-weight: bold; color: #666666; } } .Stile6 a { color: #666666; text-decoration: none; font-weight: bold; font-size: 12px; } .Stile6 a:hover { color: #0099ff; text-decoration: none; font-weight: bold; } .Stile7 {font-family: Tahoma color: #666666; font-size: 12px; } --> </style> </head> <body style="margin-left: 0, margin-right: 0"> <div align="center"><span class="Stile7">Ci sono un totale di<font size="1"> <?php echo "$totale" ?></font></span><span class="Stile7"> messaggi nel guestbook,</span><font size="1"><span class="Stile7"> in <?php echo "$scritta"; ?></span></font> <br> <br> <table width="100%" border="0"> <tr class="main" align="center"> <td width="100%"><font class="scritte"><b>Messaggi</b></font></td> </tr> </table> <?php if ($pag == 1 OR !$pag) { $pagina = 0; } else { $pagina = $pag-1; } $ultimo_mess = $pagina*$per_pagina; if ($pagina == 0) { $ultima_pag = $per_pagina*1; } else { $ultima_pag = $per_pagina*$pag; } // Gestione link pagina \\ if (!$pag) { $precedente = "<font color=\"#003399\"><< precedente</font>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $successiva = "<a href=\"$PHP_SELF?pag=2\">successiva >></a>"; } } else { if ($pag == 2) { $precedente = "<a href=\"$PHP_SELF\"><< precedente</a>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $successiva = "<a href=\"$PHP_SELF?pag=3\">successiva >></a>"; } } else { // Se non �la pag 2 \\ $prec = $pag-1; $precedente = "<a href=\"$PHP_SELF?pag=$prec\"><< precedente</a>"; if ($ultima_pag >= $totale) { $successiva = "<font color=\"#003399\">successiva >></font>"; } else { $succ = $pag+1; $successiva = "<a href=\"$PHP_SELF?pag=$succ\">successiva >></a>"; } } } for ($messaggio = $ultimo_mess; $messaggio < $ultima_pag; $messaggio++) { $messaggi = $controllo[$messaggio]; $array = explode(", ", $messaggi); if ($array[1] == "") { } else { if ($approva == "Si" AND $array[6] == "0") { } else { ?> <script language="JavaScript" type="text/javascript"> function apri(mail) { window.open('mail.php?mail='+mail,'Invia','toolbar,width=550,height=450,left=200,top=100,resizable=no'); } function smiley(code) { var testo = document.form.testo.value; this.code = code; document.form.testo.value = testo + code; } </script> <?php if ($array[4] == "") { $mail = ""; } else { $vai=$array[4]; $mail = "<a href=\"javascript:apri('$vai');\" title=\"Invia una e-mail a $array[0]\"><img src=\"img/email.gif\" border=\"0\" alt=\"\"></a>"; } $array[0] = str_replace("%&", ",", $array[0]); $array[1] = str_replace("%&", ",", $array[1]); $array[4] = str_replace("%&", ",", $array[4]); $array[0] = str_replace("<", "<", $array[0]); $array[0] = str_replace(">", ">", $array[0]); $array[1] = str_replace(";:;", "<", $array[1]); $array[1] = str_replace(":;:", ">", $array[1]); $array[1] = wordwrap($array[1],13,"\n",1); $array[1] = ereg_replace("(((http|ftp|https)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?","<a href=\"http://\\0\" target=\"".$target."\_blank\">\\0</a>", $array[1]); $array[1] = stripslashes($array[1]); echo "<table width=\"100%\" border=\"0\"> <tr> <td width=\"100%\" valign=\"top\"><b>$array[0]: </b>$array[1] $mail<br>$array[3] del $array[2]</td> </tr> </table>"; } } } ?> <br> <table width="100%" border="0"> <tr> <td class="Stile6" width="50%" align="right"><?php echo "$precedente" ?></td> <td class="Stile6" width="50%" align="left"><?php echo "$successiva" ?></td> </tr> </table><br> <form id="contact" method="post" action="scrivi.php" name="form"> <table width="100%" border="0" align="center"> <tr> <td height="20" align="center"><input name="autore" type="text" class="Stile1" value="Nome" size="16" maxlength="12"></td> </tr> <tr> <td height="20" align="center"><input name="testo" type="text" class="Stile1" value="Messaggio" size="16" maxlength="<?php echo $massimo; ?>"></td> </tr> <tr> <td height="20" align="center"><input name="mail" type="text" class="Stile1" value="Email" size="16"></td> </tr> </table> <table width="100%" border="0" align="center"> <tr> <td align="center"><?php $smiley = "smiley/smiley.txt"; $apri = fopen($smiley, 'r+'); $grandezza = filesize($smiley); $leggi = fread($apri, $grandezza); $capo = chr(13); $controllo = explode(" - ", $leggi); $parole = "smiley/parole.txt"; $apria = fopen($parole, 'r+'); $grandezzaa = filesize($parole); $leggia = fread($apria, $grandezzaa); $controlloa = explode(" - ", $leggia); foreach($controllo as $limi) { $ciao = explode(" ", $limi); if ($ciao[0] == "") { } else { $faccina .= "<img alt=\"\" src=smiley/$ciao[0].gif title=$ciao[1] style=cursor:pointer onClick=smiley(' $ciao[1]')>"; } } ?> <table width="100%" border="0"> <tr> <td width="100%" align="center"><?php echo "$faccina"; ?></td> </tr> </table> </td> </tr> <tr> <td align="center"><input type="submit" name="invia" value="Invia"></td> </tr> </table></form> <div align="center" class="Stile5"><br> <span class="Stile5"><a href="admin/index.php" target="rightFrame">Admin</a> powered by <a href="http://www.clairative.it" target="_blank">Clairative</a>. Copyright clairative</span></div> </div> </body> </html> <?php } ?>fai copia incolla
-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi

