non ho capito il discorso del SID, che problemi ti dava
Praticamente avevo una cosa del genere
in cima alla pagina:
Codice PHP:
session_start();
$_SESSION['check']=time(); 
e nel js
Codice PHP:
function insert(){
        var 
agenda= new Object();
        
agenda['id']= encodeURIComponent(index);
        
agenda['date']= encodeURIComponent(getMyDate());
        
agenda['content']= encodeURIComponent(frm.elements[0].value);
        
removeFirstChild(errors);
        if(
isEmpty(agenda['content'])){
            
showMsg(errors,emptyError);
        }
        else{
            var 
bustcache=bust(insertFile);
            var 
agenda'agenda='+agenda.toJSONString();
            
xhrInsert.connect(insertFile+bustcache,'POST',agenda,checkInsert);
            
frm.elements[0].value='';
        }
    }; 
Ecco se come prima cosa nello script
schiacciavi insert lo script non segnalava errori
perchè in agenda['content'] metteva il SID !
(Alla fine nello script con json ho adottato la tecnica
+ facile )