Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2008, 13:06
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 17 años, 6 meses
Puntos: 28
Logout sistema de usuarios

Saludos
tengo un sistema de usuarios donde como todo posee un boton de logout... pero tiene un detalle al dar logout me voy a login.php... perfecto hasta ese punto...
pero si intento loguera con otro usuario o el mismo no me deja a menos q cierre el explorador y lo vuelva a abrir... alguien sabra cual es el problema???

aqui les dejo el codigo del login y el logout

login.php
Código PHP:
<?php
include_once ('conect.php');
@
$valid=$_REQUEST['valid'];
if (
$valid==1){
$msj="El usuario o la clave que introdujo no son vàlidas. Por favor intente nuevamente!.";
}
?>

<table width="500" height="214" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="19" valign="top" class="text"><img src="imgs/header.jpg" width="500" height="100" /></td>
  </tr>
  <tr>
    <td height="184" valign="top" class="text"><p align="center" class="style7"><br />
      Secci&oacute;n Privada para Clientes</p>
      <p align="center" class="style10">&nbsp;</p>
  <form action="includes/login.php" method="post" name="login_form" id="login_form">
<table width="173" border="0" align="center">
            <tr>
              <td width="43" class="text"><span class="azulgrs_tah style10">Usuario</span></td>
              <td width="150"><input name="email" type="text" class="style10" value="" size="20" /></td>
            </tr>
            <tr>
              <td class="azulgrs_tah style10">Clave:</td>
              <td><input name="clave" type="password" class="style10" value="" size="20" /></td>
            </tr>
            <tr>
              <td class="text">&nbsp;</td>
              <td align="right">
                  <div align="right">
                    <input name="btn_aeptar" type="submit" class="style10" value="Aceptar" />
                  </div></td>
            </tr>
        </table>
        <p align="center"><span class="style10">Si Ud. es cliente de Partenon,<br />
ingrese su Usuario y Clave y   presione &quot;<span class="texto_marronosc_normal">Aceptar</span>&quot;</span></p>
  <p align="center">
            <?=$msj?></p>
      </form></td>
  </tr>
</table>
login.php en la carpeta includes
Código PHP:
<?php
session_start
();
include 
"../conect.php";
$email strtolower ($_REQUEST["email"]);
$clave strtolower ($_REQUEST["clave"]);
//echo $email."....".$clave;
/*        
        $sql="select * from usuario"; //LOGIN DE USUARIOS
        $sql_exec = mysql_query($sql);
        //$rec = mysql_fetch_array($sql_exec);
        while($rec = mysql_fetch_array($sql_exec)){
        echo $rec['email']."---".$rec['clave']."<br>";
        }
*/


    
if(empty($email) or empty($clave)){
    
//error tipo: 1 campos vacios.
    
header("Location: ../login.php");
    }else{

        
$sql="select * from usuario where email='".$email."' and clave='".$clave."' "//LOGIN DE USUARIOS
        
$sql_exec mysql_query($sql);
        
$rec mysql_fetch_array($sql_exec);
        
//echo mysql_num_rows($sql_exec);
        //echo mysql_error();
                
if ($rec['email'] == $email  and $rec['clave'] == $clave  ){
                

                                    
$_SESSION['id']=$rec["id"];//ID DEL USUARIO
                                    
$_SESSION['nombre']=$rec["nombre"];//nombre del usuario
                                    
$_SESSION['email']=$rec["email"];//email
                                    
$_SESSION['id_tipo_usuario']=$rec["id_tipo_usuario"];//ID DEL USUARIO
 
                                    
header("Location: ../ficha_users.php");
                }else{ 
                
$msj="Error";
                
//error tipo: 2 usuarios no esta registrado en la base de datos    
                
header("Location: ../login.php");
                }
    }    
    
?>
logout.php

Código PHP:
<?php  require_once('conect.php'); ?>
<?php
setcookie
("email"); 
setcookie("clave"); 
session_start(); 
session_destroy(); 
header('Location:login.php'); 
?>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...