Foros del Web » Programando para Internet » PHP »

no me entra en la session...

Estas en el tema de no me entra en la session... en el foro de PHP en Foros del Web. Buenas tengo una pagina que funcionaba en phpeasy con php 4.0 y iba perfectamente pero luego la cambie al servidor xampp con php 5.0 pero ...
  #1 (permalink)  
Antiguo 19/03/2009, 10:55
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
no me entra en la session...

Buenas tengo una pagina que funcionaba en phpeasy con php 4.0 y iba perfectamente pero luego la cambie al servidor xampp con php 5.0 pero al principio me daba un error pero era por tener un enter antes del "<?php" pero ahora ya no me sale ningun error se me ve la pagina perfectamente pero cuando meto el usuario y contraseña en la pagina index.php en vez de meterse dentro de la pagina admin.php vuelve a la pagina de login(index.php)

Yo creo que es por que mi pagina guarda las sessiones en la BD y no tengo configurado el php ini por que no macuerdo de los cambios que le hize...

aqui dejo el codigo ayudadme por favor...

GRACIAS

index.php

Código PHP:



echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>


<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='es' lang='es'>

<head>
<title>Administrador De Disco Duro</title>

<META HTTP-EQUIV='PRAGMA' CONTENT='NO-CACHE'>    

<link rel='stylesheet' href='css/login.css?nc' type='text/css'>


    <script language='javascript' type='text/javascript' src='js/png.js'></script>
    




";
?>
<script>
function otwin(){
   document.getElementById("bstopie").style.display='none'
    document.getElementById("stopie").style.display='none'

}
function stopmsie(){

   document.getElementById("bstopie").style.display = 'block';
   document.getElementById("stopie").style.display = 'block';
}
</script>
 </head>
<body onLoad="stopmsie()">
<form name="login" method="POST" action="login.php">
<input type="hidden" name="is_submit" value="ok" />

<center> <br><br>   <br> 
<center>
<br clear="all">
<br> 
          <table align=center border=0 cellpadding=0 cellspacing=0 width="407">
            <tr>
              <td  background="img_desing/uplog.png" height="20"  >
              </td>
            </tr>
            <tr>
              <td height="300">

                <table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
                  <tr>
                    
                    <td background="img_desing/middlelog.png" align="center" width="407" >

                      <table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
                        <tr>
                          <td align="center">
                            <a target="_blank">
                            <img src="img_desing/headerlog.png" width="346" height="174" style="border: 0px none" scale="noborder"></a>
                          </td>
                        </tr>
                        <tr>
                          <td align="center" height="40">
                            <font face=Tahoma style="font-size:10pt;"><b>[Administracion 
                            Web]</b> | [Login]</font>
                          </td>
                        </tr>
                      </table>

                    </td>
                    <!-- <td width="5" background="img/login_righttop.gif">
                      <img src="img/transparent.gif" alt="" border="0" style="border: 0px none" width="1" height="1" />
                    </td>-->
                  </tr>
                </table>

              </td>
            </tr>
            <tr>
              <td style="height: 1px" background="img_desing/login_topseperator.png" height="1">
              </td>
            </tr>
            <tr>
              <td height="130">

                <table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
                  <tr>
                    
                    <td background="img_desing/login_downmain.png" align="center">
                       
<table width="255">
    <tr>
        <td align="center" colspan="2"> <br> </td>
    </tr>
    <tr>
        <td align="right"><label for="usr">Usuario:</label>&nbsp;</td>
        <td><input name="usuario" type="text" value="" size="25" class="inputtext">
                        </td>
    </tr>
    <tr>
        <td align="right"><label for="pwd">Contraseña:</label>&nbsp;</td>
        <td><input type="password" name="pass" value="" size="25" class="inputtext"></td>
    </tr>
    <tr>
                        <font face=Tahoma style="font-size:10pt;">
        <td align="center" style="font-family: Verdana, Arial; font-size: 8pt" width="77">&nbsp;</td>
        <td style="font-family: Verdana, Arial; font-size: 8pt" width="160" align="center">
                        <font face=Tahoma style="font-size:10pt;">
      <!--  <input type="submit" name="submit" value="Iniciar Sesión" size="120" style="font-family: Verdana, Arial; font-size: 8pt" tabindex="1">
   <a href="#" onclick="javascript:document.login.submit()"><img src="img_desing/login.jpg" border="0"></a>
   <input type="image" name="submit" src="img_desing/login.jpg" value="Iniciar Sesión" size="120" style="font-family: Verdana, Arial; font-size: 8pt" tabindex="1" onmouseover="submit.src='img_desing/login2.jpg'">-->
   
   <input name="submit" type="image"  onMouseOver="this.src='./img_desing/botonlogeoon.png'" onMouseDown="this.src='./img_desing/botonlogeodown.png'" onMouseOut="this.src='./img_desing/botonlogeo.png'" src="img_desing/botonlogeo.png" value="Iniciar Sesión" class="boton">
                        </font></td>
        <td align="center" style="font-family: Verdana, Arial; font-size: 8pt" width="6" >&nbsp; </td>
</font>
    </tr>
</table>

                        <p>
                        <font color="#19445d">      <?php echo "$logerr"?>
                       <br>
                        </font>
                          </p>
                           </td>
                    </td>
                    
                  </tr>
                </table>

              </td>
            </tr>
            <tr>
              <td style="height: 12px" background="img_desing/downlog.png" height="20"  >
              </td>
            </tr>
          </table>

 
 </center></center></form></body>
login.php
Código PHP:



//
//THIS FOLLOWING SCRIPT HAS BEEN CREATED BY JOE COOPER ([email protected]) ON 10/MARCH/06 FOR "PROJECT X"
//This is the user login script that allows the user to enter their username or password into the form to login
//The password uses MD5 encryption
//
include("codes/db.php");
include(
"codes/manejoSesiones.class.php");

ini_set('session.gc_maxlifetime'350);
ini_set('session.cookie_lifetime'350); 

$sesionOA = new manejoSesiones();
session_set_save_handler(array(&$sesionOA,'abrirSesion'),array(&$sesionOA,'cerrarSesion'),array(&$sesionOA,'leerSesion'),array(&$sesionOA,'escribirSesion'),array(&$sesionOA,'borrarSesion'),array(&$sesionOA,'recolector'));

session_start(); //start the session

  
$username=$_POST['usuario']; //Get the username the user has entered
  
  
$password=$_POST['pass']; //Get the password the user has entered
 
$password=md5($password); //turn the password they entered into md5 to compare with the DB
 
  
$loginname=$_SESSION['username'];

//check to see if logged in allready
if (isset($_SESSION['loggedin'])){
    
die(
"You are logged in<br><a href='logout.php'>Click here to logout</a>");
//if not logged in, then run other script instead
}else{
     
//find if the page was enterd by the login button
if ( isset( $_POST['is_submit'] ) && ( $_POST['is_submit'] == 'ok' ) ) {
    
      
  
//if username was entered, continue
  
if($username && $password){
      
$result=mysql_query($sql);
      
//If the user gets to here, then they have typed both a username and password, so we may now go onto finding out if they excist in the DB
      
$sql="SELECT * FROM administradores WHERE (administrador='$username') AND password='$password'"//get rows where the username feild matches the username or email feild in the database with same password
      
$result=mysql_query($sql);
      
//check to see if the account is activated
      
$moorow=mysql_fetch_array($result);
   
      
//if there was a row returned, then obiously there is an account with the correct username/password. They may login!
        
if (mysql_num_rows($result) > 0){
        
$_SESSION['loggedin']="TRUE"//set the global session varible for loggedin to true
        
$row=mysql_fetch_array($result);
        
$_SESSION['username']=$username;
         
//setcookie("usuario", $username, time() + 31536000);   
        // setcookie("pass", $password, time() + 31536000);
        
$sql="SELECT sexo FROM administradores WHERE administrador='$username'"
            
$result=mysql_query($sql);
            
$sex=mysql_result($result,0,0);
         
$_SESSION['sexo']=$sex;
        
mysql_free_result($result);
        
         
header("Location: admin.php");
        
//die("Welcome $username You are now logged in");
        
}else{
        
header("Location: index.php?msg=err");
        
        }
       
  }else{
    
  
header("Location: index.php?msg=not");
  }
}

  #2 (permalink)  
Antiguo 19/03/2009, 11:46
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

En cada script donde requieras tener acceso a las variables de sesion debes incluir session_start(); y establecer la misma configuracion que en login.php
__________________
- León, Guanajuato
- GV-Foto
  #3 (permalink)  
Antiguo 19/03/2009, 11:52
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

Cita:
Iniciado por Triby Ver Mensaje
En cada script donde requieras tener acceso a las variables de sesion debes incluir session_start(); y establecer la misma configuracion que en login.php
si esque lo tengo hecho mira este es el codigo que me dici estoy conectado...

el codigo en verdad funciona por que en phpeasy funciona a la perfeccion...



gracias


Código PHP:
<?php
include("db.php");
  
// No almacenar en el cache del navegador esta página.
        
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                     // Expira en fecha pasada
        
        
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");        // Siempre página modificada
        
header("Cache-Control: no-cache, must-revalidate");                   // HTTP/1.1
        
header("Pragma: no-cache");   
        
        include(
"codes/manejoSesiones.class.php");
ini_set('session.gc_maxlifetime'350);
ini_set('session.cookie_lifetime'350); 
        
$sesionOA = new manejoSesiones();
session_set_save_handler(array(&$sesionOA,'abrirSesion'),array(&$sesionOA,'cerrarSesion'),array(&$sesionOA,'leerSesion'),array(&$sesionOA,'escribirSesion'),array(&$sesionOA,'borrarSesion'),array(&$sesionOA,'recolector'));


                                   


//$pass=$_COOKIE["pass"];
session_start();

if (!isset(
$_SESSION['loggedin'])){
    
    
$logerr=$HTTP_GET_VARS["msg"];

      switch(
$logerr){
          case 
"err";
              
$logerr="Usuario y/o Contraseña no es válido";
              break;
          case 
"not";
              
$logerr="Introduzca Usuario y Contraseña";
              break;
        default;
              
$logerr="";
              break;
      }
        include(
"index.php");
    exit;
}else{

$sex=$_SESSION['sexo'];     
$user=$_SESSION['username'];
$user=ucwords($user);





}
  #4 (permalink)  
Antiguo 19/03/2009, 11:57
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

dejo mi configuracion de php.ini aver si me podeis ayudar...

[Session]
; Handler used to store/retrieve data.
session.save_handler = user

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; As of PHP 4.0.1, you can define the path as:
;
; session.save_path = "N;/path"
;
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
;
; The file storage module creates files using mode 600 by default.
; You can change that by using
;
; session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
session.save_path = "K:\xampp\tmp"

; Whether to use cookies.
session.use_cookies = 1

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 3600

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data. php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 3600

; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm

; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit register_globals
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning separately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.

session.bug_compat_42 = 1
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
; to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
; in publically accessible computer.
; - User may access your site with the same session ID
; always using URL stored in browser's history or bookmarks.
session.use_trans_sid = 0

; Select a hash function
; 0: MD5 (128 bits)
; 1: SHA-1 (160 bits)
session.hash_function = 0

; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
;
; 4 bits: 0-9, a-f
; 5 bits: 0-9, a-v
; 6 bits: 0-9, a-z, A-Z, "-", ","
session.hash_bits_per_character = 4

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden <input> field with the info which is otherwise appended
; to URLs. If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a "=", even if no value follows.
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fields et="
  #5 (permalink)  
Antiguo 19/03/2009, 12:10
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Cita:
Iniciado por php.net
Note: Si está usando sesiones basadas en las cookies, debe llamar a session_start() antes de que haya ninguna salida al navegador.
Intenta poniendo los headers despues de session_start();

Mas info en: www.php.net
__________________
- León, Guanajuato
- GV-Foto
  #6 (permalink)  
Antiguo 19/03/2009, 12:40
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

lo he puesto delante incluso he quitado los headers y sigue igual,lo bueno es que me inicia sesion (aunque no me deje entrar) porque cuando vuelvo a entrar el usuario y contraseña me dice que ya estoy logueado...

para que me diga eso la session debe estar creada corresponde a esta parte del codigo...

pero en cambio en ifsesion.php(que es el que me verifica si estoy logueado para dejarme ver la pagina hay el mismo "if (isset($_SESSION['loggedin'])){" pero al revés "if (!isset($_SESSION['loggedin'])){" y aqui en teoria me tendria que decir que esta creada la session pero me dice que no...

gracias

Código PHP:
if (isset($_SESSION['loggedin'])){
    
die(
"You are logged in<br><a href='logout.php'>Click here to logout</a>");
//if not logged in, then run other script instead 
  #7 (permalink)  
Antiguo 19/03/2009, 12:49
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Si realmente esta creada la sesion puedes probar un var_dump() en ifsesion.php para ver lo que se guardo y saber porque falla.

Código php:
Ver original
  1. echo '<pre>';
  2. var_dump($_SESSION);
  3. die('</pre>');

Nota, $HTTP_GET_VARS es obsoleto, seguramente en versiones futuras de PHP ya no estara disponible, en su lugar usa $_GET
__________________
- León, Guanajuato
- GV-Foto
  #8 (permalink)  
Antiguo 19/03/2009, 13:38
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

merci con la informacion...

te explico es muy raro lo que le pasa a la web...

cuando meto dos veces la contraseña que me sale el mensaje de que ya estoy logueado me sale el siguiente array...

array(3) {
["loggedin"]=>
string(4) "TRUE"
["username"]=>
string(6) "javier"
["sexo"]=>
string(1) "o"
}


y cuando meto la contraseña e inento acceder a alguna pagina y me devuele a la pagina para loguearme me sale esto...

array(0) {
}


no lo entiendooo
  #9 (permalink)  
Antiguo 19/03/2009, 14:43
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Se supone que cuando pones la contraseña correcta te redirige a admin.php, verifica que ahi hay un session_start() y pones ahi mismo el var_dump() para ver que esta pasando.
__________________
- León, Guanajuato
- GV-Foto
  #10 (permalink)  
Antiguo 19/03/2009, 15:29
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

es donde lo tengo puesto...

me sale que no hay una sesion...

array(0) {
}

mercii

Código PHP:
session_start();

if (!isset(
$_SESSION['loggedin'])){
    
    
$logerr=$HTTP_GET_VARS["msg"];

      switch(
$logerr){
          case 
"err";
              
$logerr="Usuario y/o Contraseña no es válido";
              break;
          case 
"not";
              
$logerr="Introduzca Usuario y Contraseña";
              break;
        default;
              
$logerr="";
              break;
      }
        include(
"index.php");
            echo 
"<pre>";

      
var_dump($_SESSION);

      die(
"</pre>");
    exit;
}else{

$sex=$_SESSION['sexo'];     
$user=$_SESSION['username'];
$user=ucwords($user);



//aqui me redirecciona para admin.php


  #11 (permalink)  
Antiguo 19/03/2009, 17:36
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Has intentado sin usar la clase para manejo de sesiones?
__________________
- León, Guanajuato
- GV-Foto
  #12 (permalink)  
Antiguo 20/03/2009, 04:28
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

cuando elimino el...

Código PHP:
//$sesionOA = new manejoSesiones();
//session_set_save_handler(array(&$sesionOA,'abrirSesion'),array(&$sesionOA,'cerrarSesion'),array(&$sesionOA,'leerSesion'),array(&$sesionOA,'escribirSesion'),array(&$sesionOA,'borrarSesion'),array(&$sesionOA,'recolector')); 
funciona perfectamente pero como puedo hacer para que me funcione por que necesito que me ponga a los usuarios en la BD...

Gracias por todo
  #13 (permalink)  
Antiguo 20/03/2009, 11:01
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

esta es la clase que utilizo para guardar las sesiones en php...

haver si me podeis ayudar...

gracias

Código PHP:
class manejoSesiones {
    var 
$tiempoExpirado;
    var 
$tablaSesiones "sesiones";
    
    function 
abrirSesion($savePath$sessionID) {
        global 
$dbc;
        
        return 
true;
    }
    
    function 
cerrarSesion() {
        global 
$dbc;
        
        
$this->tiempoExpirado ini_get('session.gc_maxlifetime');
        
        
$this->recolector($this->tiempoExpirado);
        return 
true;
    }
    
    function 
leerSesion($sessionID) {
        global 
$dbc;
        
        
$sql "SELECT * FROM ".$this->tablaSesiones." WHERE sessionID = '$sessionID'";
        
$result mysql_query($sql);
        
        if(!
$result) { return false; }
        
        
$num mysql_num_rows($result);
        if(
$num 0) {
            
$data mysql_fetch_assoc($result);
            return 
$data['sessionData'];
        }else{
            return 
false;
        }
    }
    
    function 
escribirSesion($sessionID$sessionData) {
        global 
$dbc;
       
        
//loggedin|s:4:"TRUE";username|s:6:"javier";sexo|s:1 :"o";
        
list($logedinses$userses$sexses) = explode(";"$sessionData);
        
$sesionuser explode("\""$userses);
        
$sesionuser $sesionuser[1]; // trozo1
 // trozo2
        
if ($sessionData!=""){
        
$sql "UPDATE ".$this->tablaSesiones." SET sessionData = '$sessionData' WHERE sessionID = '$sessionID'";
        
$result mysql_query($sql);
        
        if(
mysql_affected_rows()) {
            return 
true;
        }else{
        
            
$sql "INSERT INTO ".$this->tablaSesiones." (sessionID, sessionStart, sessionData, sessionUser) VALUES ('$sessionID','".time()."','$sessionData','$sesionuser')";
            
$result mysql_query($sql);
            return (!
$result) ? false true ;
        }
        }
    }
    
    function 
borrarSesion($sessionID) {
        global 
$dbc;
        
        
$sql "DELETE FROM ".$this->tablaSesiones." WHERE sessionID = '$sessionID'";
        
$res mysql_query($sql);
        return (!
$res) ? false true ;
    }
    
    function 
recolector($tiempo) {
        global 
$dbc;
        
        
$sql "DELETE FROM ".$this->tablaSesiones." WHERE ".time()." > (sessionStart + ".$tiempo.")";
        
$res mysql_query($sql);
        return (!
$res) ? false true ;
    }

  #14 (permalink)  
Antiguo 20/03/2009, 13:11
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Parece que quieres guardar el nombre de usuario en la tabla de sesiones y tal vez es ese fragmento de codigo lo que esta fallando. Yo dejaria la clase para manejo de sesiones intacta y crearia una funcion que busque / des-serialice el nombre de usuario en la tabla de sesiones.
__________________
- León, Guanajuato
- GV-Foto
  #15 (permalink)  
Antiguo 20/03/2009, 17:06
 
Fecha de Ingreso: noviembre-2007
Mensajes: 229
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: no me entra en la session...

como que busque y deserialice el nombre de usuario??

muchas gracias por todo...
  #16 (permalink)  
Antiguo 20/03/2009, 17:22
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: no me entra en la session...

Código php:
Ver original
  1. //loggedin|s:4:"TRUE";username|s:6:"javier";sexo|s:1 :"o";
  2.         list($logedinses, $userses, $sexses) = explode(";", $sessionData);
  3.         $sesionuser = explode("\"", $userses);
  4.         $sesionuser = $sesionuser[1]; // trozo1
  5.  // trozo2

Esta es la parte del codigo donde quieres extraer el nombre de usuario para guardarlo en la tabla de sesiones, el formato es una especie de serializado y creo que todo el bloque podria ser la causa de que no funcionen las sesiones correctamente.

Si quitas (o pones como comentarios) este codigo, en el INSERT que aparece mas abajo, correspondiente al ELSE, tendrias que quitar ,'$sesionuser' tambien.
__________________
- León, Guanajuato
- GV-Foto
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:35.