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ón Privada para Clientes</p>
<p align="center" class="style10"> </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"> </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 "<span class="texto_marronosc_normal">Aceptar</span>"</span></p>
<p align="center">
<?=$msj?></p>
</form></td>
</tr>
</table>
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");
}
}
?>
Código PHP:
<?php require_once('conect.php'); ?>
<?php
setcookie("email");
setcookie("clave");
session_start();
session_destroy();
header('Location:login.php');
?>