Visualizzazione dei risultati da 1 a 7 su 7

Discussione: Parse error

  1. #1
    Utente di HTML.it L'avatar di ice_boy
    Registrato dal
    Nov 2004
    Messaggi
    290

    Parse error

    Salve , ho questo codice :
    <html>
    <head>
    <title>Inserimento del messaggio</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

    <body bgcolor="#DAF4FE">
    <?php

    include("configR.php");
    $nome=$_POST['nome'];
    $email=$_POST['email'];
    $url=$_POST['tel'];
    $messaggio=$_POST['messaggio'];
    $mezzo=$_POST['mezzo'];
    $alimentazione=$_POST['alimentazione'];

    // Rilevazione tag html, presenza del nome e del messaggio
    $cercanome = strstr($nome,"<");
    $cercanome2 = strstr($nome,">");
    $cercaem = strstr($email,"<");
    $cercaem2= strstr($email,">");
    $cercaurl = strstr($tel,"<");
    $cercaurl2 = strstr($tel,">");
    $cercames = strstr($messaggio,"<");
    $cercames2 = strstr($messaggio,">");

    $parole=explode(" ",$messaggio);
    $dim_parole=count($parole);

    $check=1;
    for ($i=0;$i<$dim_parole;$i++)
    {
    if ( strlen($parole[$i]) > $word_lenght )
    {
    $check=0;
    }
    }

    if ($check==1)
    {

    if ( $cercanome & $cercanome2 ){
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ( $cercaem & $cercaem2 )
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ( $cercaurl & $cercaurl2 )
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ($cercames & $cercames2)
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif (($email!="") & !(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)))
    {
    echo "<center><font size=\"2\">L'INDIRIZZO EMAIL NON SEMBRA ESSERE VALIDO</font></center>
    ";
    echo "<center><font size=\"2\">TORNA INDIETRO</font></center>";
    }
    else{
    if ($tel == "")
    {
    echo "<center><font size=\"2\">DEVI INSERIRE IL TUO NUMERO</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    else{
    if ($nome == "")
    {
    echo "<center><font size=\"2\">DEVI INSERIRE IL TUO NOME</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ($messaggio == "")
    { echo "<center><font size=\"2\">DEVI INSERIRE IL MESSAGGIO</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }

    else{

    $messaggio=ereg_replace("\n","
    ",$messaggio);
    $messaggio=stripslashes($messaggio);
    $nome=stripslashes($nome);

    $data=date("d/m/Y");
    $orario=date("H.i");

    $commento=$nome."|".$email."|".$url."|".$modello." |".$mezzo."|".$alimentazione."|".$marca."|".$messa ggio."|".$data."|".$orario."\n";

    if (!(file_exists($file)))
    {fopen($file,"w");}

    // Scrittura del nuovo messaggio su file
    $new_mess=fopen($file,"a+");
    fwrite($new_mess,$commento);
    fclose($new_mess);

    $arr_mess=file($file);
    $count=count($arr_mess);

    $pagine_totali= ceil($count/$risultati_per_pagina);

    $tab_ins= "<table width=\"400\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" bordercolor=\"#333333\" bgcolor=\"#FFFFFF\" style=\"border:1px solid;\">";
    $tab_ins .= "<tr><td><center><font family=\"Arial\" size=\"2\">IL TUO ANNUNCIO E' STATO INVIATO CORRETTAMENTE</font></center>";
    $tab_ins .= "</td></tr></table>
    ";
    $tab_ins .= "<table width=\"400\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"#FFFFFF\" style=\"border:1px solid;\">";
    $tab_ins .="<tr><td bgcolor=\"#FFFFCC\"><center><font family=\"Arial\" size=\"2\">VISUALIZZA I MESSAGGI</font></center></td></tr></table>";
    echo $tab_ins;
    }
    }
    }
    else{
    echo "<center><font face=\"Verdana\" size=\"2\">HAI INSERITO NEL MESSAGGIO UNA PAROLA TROPPO LUNGA</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    ?>
    </body>
    </html>

    che quando viene eseguito mi da :
    Parse error: parse error, unexpected T_ELSE in /membri2/flirt/insertR.php on line 116

    perchè?

  2. #2
    Utente di HTML.it L'avatar di ilmila
    Registrato dal
    Apr 2005
    Messaggi
    68
    Hai dimenticato di chiudere una parentesi graffa alla linea 114 .

    Cmq io nn eseguirei tutti quei controlli (se nn sono strettametne necessari)eseguirei direttamente la funzione strip_tags() che elimina in automatico qualsiasi tag html e php dalle variabili
    Sistema Acquisizione Risultati Sportivi
    Sistema Prenotazione Posti
    http://parse2005.altervista.org/

  3. #3
    Utente di HTML.it L'avatar di ice_boy
    Registrato dal
    Nov 2004
    Messaggi
    290
    strip_tags() come si usa?
    la parrentesi graffa alla linea 114 , mi sembra chiusa
    }
    o no?

  4. #4
    Utente di HTML.it L'avatar di ilmila
    Registrato dal
    Apr 2005
    Messaggi
    68
    strip_tags()

    manuale php

    http://it.php.net/manual/it/function.strip-tags.php


    si manca una parentesi graffa.Usa un programma per l'identazione del codice php che colora la semantica e ti rende più facile capire dove apri e chiudi le parentesi
    ce ne sono anche di free in rete di php editor
    Sistema Acquisizione Risultati Sportivi
    Sistema Prenotazione Posti
    http://parse2005.altervista.org/

  5. #5
    Utente di HTML.it L'avatar di ice_boy
    Registrato dal
    Nov 2004
    Messaggi
    290
    e per l'errore? t seccheresti postarmi il codice corretto?

  6. #6
    Utente di HTML.it L'avatar di ilmila
    Registrato dal
    Apr 2005
    Messaggi
    68
    codice:
    <html>
    <head>
    <title>Inserimento del messaggio</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    
    <body bgcolor="#DAF4FE">
    <?php
    
    include("configR.php");
    $nome=$_POST['nome'];
    $email=$_POST['email'];
    $url=$_POST['tel'];
    $messaggio=$_POST['messaggio'];
    $mezzo=$_POST['mezzo'];
    $alimentazione=$_POST['alimentazione'];
    
    // Rilevazione tag html, presenza del nome e del messaggio
    $cercanome = strstr($nome,"<");
    $cercanome2 = strstr($nome,">");
    $cercaem = strstr($email,"<");
    $cercaem2= strstr($email,">");
    $cercaurl = strstr($tel,"<");
    $cercaurl2 = strstr($tel,">");
    $cercames = strstr($messaggio,"<");
    $cercames2 = strstr($messaggio,">");
    
    $parole=explode(" ",$messaggio);
    $dim_parole=count($parole);
    
    $check=1;
    for ($i=0;$i<$dim_parole;$i++)
    {
    if ( strlen($parole[$i]) > $word_lenght )
    {
    $check=0;
    }
    }
    
    if ($check==1)
    {
    
    if ( $cercanome & $cercanome2 ){
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ( $cercaem & $cercaem2 )
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ( $cercaurl & $cercaurl2 )
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ($cercames & $cercames2)
    {
    echo "<center><font size=\"2\">IL TUO MESSAGGIO NON E' STATO INSERITO IN QUANTO SONO STATI RILEVATI TAG HTML</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif (($email!="") & !(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)))
    {
    echo "<center><font size=\"2\">L'INDIRIZZO EMAIL NON SEMBRA ESSERE VALIDO</font></center>
    ";
    echo "<center><font size=\"2\">TORNA INDIETRO</font></center>";
    }
    else{
    if ($tel == "")
    {
    echo "<center><font size=\"2\">DEVI INSERIRE IL TUO NUMERO</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    else{
    if ($nome == "")
    {
    echo "<center><font size=\"2\">DEVI INSERIRE IL TUO NOME</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    elseif ($messaggio == "")
    { echo "<center><font size=\"2\">DEVI INSERIRE IL MESSAGGIO</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    
    else{
    
    $messaggio=ereg_replace("\n","
    ",$messaggio);
    $messaggio=stripslashes($messaggio);
    $nome=stripslashes($nome);
    
    $data=date("d/m/Y");
    $orario=date("H.i");
    
    $commento=$nome."|".$email."|".$url."|".$modello."|".$mezzo."|".$alimentazione."|".$marca."|".$messaggio."|".$data."|".$orario."\n";
    
    if (!(file_exists($file)))
    {fopen($file,"w");}
    
    // Scrittura del nuovo messaggio su file
    $new_mess=fopen($file,"a+");
    fwrite($new_mess,$commento);
    fclose($new_mess);
    
    $arr_mess=file($file);
    $count=count($arr_mess);
    
    $pagine_totali= ceil($count/$risultati_per_pagina);
    
    $tab_ins= "<table width=\"400\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" bordercolor=\"#333333\" bgcolor=\"#FFFFFF\" style=\"border:1px solid;\">";
    $tab_ins .= "<tr><td><center><font family=\"Arial\" size=\"2\">IL TUO ANNUNCIO E' STATO INVIATO CORRETTAMENTE</font></center>";
    $tab_ins .= "</td></tr></table>
    ";
    $tab_ins .= "<table width=\"400\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"#FFFFFF\" style=\"border:1px solid;\">";
    $tab_ins .="<tr><td bgcolor=\"#FFFFCC\"><center><font family=\"Arial\" size=\"2\">VISUALIZZA I MESSAGGI</font></center></td></tr></table>";
    echo $tab_ins;
    }
    }
    }
    }
    else{
    echo "<center><font face=\"Verdana\" size=\"2\">HAI INSERITO NEL MESSAGGIO UNA PAROLA TROPPO LUNGA</font></center>
    ";
    echo "<center><font size=\"2\"><a href=\"richiedi.php\">TORNA INDIETRO</a></font></center>";
    }
    ?>
    </body>
    </html>
    questo con Zend editor non mi da errori...
    Sistema Acquisizione Risultati Sportivi
    Sistema Prenotazione Posti
    http://parse2005.altervista.org/

  7. #7
    Utente di HTML.it L'avatar di ice_boy
    Registrato dal
    Nov 2004
    Messaggi
    290
    ora funge ps potresti per favore scaricarti qua
    un file zippato che riguarda sempre questa discussione . leggi il file di testo e capirai se ci son ulteriori aiuti son ben accettati

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.