Ver Mensaje Individual
  #7 (permalink)  
Antiguo 05/10/2009, 22:03
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 10 meses
Puntos: 834
Respuesta: Cerrar Sesion

Usando algo como esto podrás destruir la sesión de manera segura:
Código PHP:
<?php
session_start
();
set_time_limit(0); 
session_write_close();
if(isset(
$_POST['control'])){
    
ignore_user_abort(1); 
    while (
1) {
         echo 
"\n";
         
ob_flush();
         
flush();
         
sleep(5);
         if (
connection_status()!=0){
                 
session_start();
                 
session_destroy();
                exit; 
         }
    }
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<script>
function http(){
    if(typeof window.XMLHttpRequest!='undefined'){
        return new XMLHttpRequest();
    }else{
        try{
            return new ActiveXObject('Microsoft.XMLHTTP');
        }catch(e){
            alert('Su navegador no soporta AJAX');
            return false;
        }
    }
}
function request(url,callback,params){
    var H=new http();
    if(!H)return;
    H.open('post',url+'?'+Math.random(),true);
    H.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    H.onreadystatechange=function(){
        if(H.readyState==4){
            if(callback)
                callback(H.responseText);
            H.onreadystatechange=function(){}
            H.abort();
            H=null;
        }
    }
    var p='';
    for(var i in params){
        p+='&'+i+'='+escape(params[i]);
    }
    H.send(p);

onload=function(){
    request('?',function(){},{'control':'1'});
}
</script>
</head>

<body>
<?php echo $_SESSION['algo'];?>
</body>
</html>