Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    A proposito di validazione xhtml ...... e GET

    Ciao a tutti.
    (Ho già provato sul forum xhtml)
    Ho provato a validare il codice xhtml
    del mio sito personale
    il risultato ottenuto non è proprio incoraggiante
    La cosa che proprio non riesco a spiegarmi
    è questo errore:
    [*]<a href="/index.php?cat=1&PHPSESSID=b0b0431f4cb19dce679974b9 e37d2b5b">Php&nb[*]<a href="/index.php?cat=1&PHPSESSID=b0b0431f4cb19dce679974b9 e37d2b5b">Php&nb
    An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (. The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".
    se vado a vedere il sorgente xhtml però ho:
    [*]Php(2)
    di &PHPSESSID=b0b0431f4cb19dce679974b9e37d2b5b neanche l'ombra
    non faccio uso nè di sessioni e nè ampersands soltanto un semplice ?
    cioè al get passo un solo valore l'id della categoria.
    Mi piacerebbe sapere cosa succede.
    PS.
    Il menu è generato dinamicamente da un file di testo
    se può centrarci qc. Ah ri-
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  2. #2
    Quel PHPSESSID viene inserito dal php perchè il tuo browser (o il tuo firewall) è impostato per non accettare i cookie di sessione.

    L'errore deriva invece dal fatto che perchè si validi l'html tutte le url presenti in esso devono usare, al posto di &, la forma estesa, ovvero &amp;amp; , come separatore per i parametri sulla url.

    Per ottenere questo, bisogna correggere il proprio codice php che genera delle url, e dire a php di fare altrettanto con

    ini_set("arg_separator.output", "&amp;");

    Ciao!
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

  3. #3

    Dunque

    Ciao.
    Innanzitutto ti ringrazio
    for the ready reply poi
    ti allego il codice che
    genera il menu:
    /*
    Il file index è strutturato
    in questo modo:
    id\tdescrizione\tnumeroPosts
    */
    function getFile($fileIndex)
    {
    $trimContent = array();
    $content = file($fileIndex);
    foreach($content as $rows)
    {
    $trimContent[]=trim($rows);
    }
    return $trimContent;
    }
    function getIndex($fileIndex)
    {
    $newcontent = array();
    $content = getFile($fileIndex);
    foreach($content as $rows)
    {
    list($id)=explode("\t",$rows);
    $newcontent[$id] = stripslashes($rows);
    }
    return $newcontent;
    }
    $menu = getIndex(DATA."cats.index");
    $path = $_SERVER['PHP_SELF'];
    echo "<ul>\n";
    foreach($menu as $rowCat)
    {
    list($idM,$titleM,$postsM)=explode("\t",$rowCat);
    if(isset($_GET['cat']))
    {
    if($idM==$getCat)
    {
    echo "[*]<a id=\"current\" href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    else
    {
    echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    }
    elseif(isset($_GET['view']))
    {
    if(safeUrl($getView,$maxP))
    {
    echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    else
    {
    $indexMenu = $userData->getIndexById(DATA."posts.index",$getView);
    list($idIndexM,$titleIndexM)=explode("\t",$indexMe nu);
    if($idM==$idIndexM)
    {
    echo "[*]<a id=\"current\" href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    else
    {
    echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    }
    }
    else
    {
    echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
    }
    }
    echo "[/list]\n";
    Il problema dell'entità ampersands
    lo avevo recepito ma non vedo cosa
    può entranci quando a get passo un valore
    solo.
    Se non colgo il nocciolo della questione
    in caso ini_set("arg_separator.output", "&");
    lo posso mettere nell'include dove tengo
    le costanti ?
    Stammi bene.
    Whisher
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  4. #4
    Si, devi.

    La cosa centra solo perchè è PHP ad aggiungere la PHPSESSIONID, sicuro di non stare usando sessioni mai? Se PHP la aggiunge è perchè trova le sessioni attive, o per qualche altra ragione...

    Sicuro che in tutto il codice che esegui per quella pagina non ci sia mai uso delle sessioni?
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

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.