Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/06/2011, 13:12
oscarbt
 
Fecha de Ingreso: abril-2009
Ubicación: Colombia
Mensajes: 949
Antigüedad: 15 años
Puntos: 27
Respuesta: se pirder valor de session al hacer UPDATE

Mira como esta:
en funcion.php tambien existe esto:

Código PHP:
Ver original
  1. function login_in($usuario, $clave)
  2. // check username and password with db
  3. // if yes, return true
  4. // else throw exception
  5. {
  6.   // connect to db
  7.   include("config.php");
  8.   include("opendb.php");
  9.   $sql = "SELECT * FROM users WHERE NOMBRE=".$usuario."' and PASSWORD='".$clave."'";
  10.   $result = mysql_query($sql);
  11.  
  12.  
  13.   if (mysql_num_rows($result) > 0)
  14.      return 1;
  15.   else
  16.      return 0;
  17. }

Y un archivo de autenticacion que tiene:

autenticacion.php

Código PHP:
Ver original
  1. <?
  2. require_once('funciones.php');
  3.  
  4. $usuario=$_POST['usuario'];
  5. $clave=$_POST['clave'];
  6.  
  7. if (login_in($usuario, $clave)==1)
  8. {
  9.    
  10.     if ($usuario=="admin"){
  11.         $_SESSION['valid_user'] = $usuario;
  12.        
  13.         header("Location: administracion.php");
  14.     }
  15.     if ($usuario!="admin")
  16.     {
  17.         $_SESSION['estud'] = $usuario;
  18.         header("Location: admin.php?optegresado=$usuario");
  19.  
  20.     }
  21. }
  22. else
  23. {
  24. echo "No estas logueado";
  25. }