Hola fata !!!
Bue te cuento que me puse a revisar paso a paso el sistemia entero de login, tampoco era tanto jejeje !!!
Entonces borre ese user.php que me trajo problemas, y lo simplifique asi:
Solo tengo 2 archivos:
login.php y comprueba.php
login.php
Código php:
Ver original<?
$url=$_SERVER['HTTP_REFERER'];
header("location:$a"); /* Antes iba a user.php */ }
else
{
?>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<head>
<title>SISTEMA DE LOGIN</title>
<link rel="stylesheet" type="text/css" media="all" href="css/full.css" />
<script type="text/javascript" src="tabular.js"></script>
</head>
<body onLoad="document.getElementById('veni').focus();">
<br><br><br>
<form id="form" name="form" action="comprueba.php" method="post">
<fieldset>
<legend>INICIO DE SESION</legend>
Login:<input type="text" name="login" size="25" id="veni" onkeypress="return tabular(event,this)"/>
<br>
Password:<input type="password" name="pass" size="8" onkeypress="return tabular(event,this)"/>
<br>
<input type="submit" name="ok" value="Entrar"/>
<input type="button" value="Salir" onclick = "self.location.href ='logout.php'"/></td>
</fieldset>
</form>
</body>
<?php
}
?>
comprueba.php
Código php:
Ver original<?php
include('conexion.php');
$url=$_SERVER['HTTP_REFERER'];
$login = $_POST['login'];
$pass = $_POST['pass'];
$result=mysql_query("select * from usuarios where login='$login'",$conexion);
//echo "No existe el login introducido"; echo "<br>";
}
else
{
//if($array['password']==crypt($pass,"semilla"))
if($array['password']==$pass)
{
$_SESSION['login']=$login;
$_SESSION['loggeado']=true;
if($a=='login.php')
{header("location:inicio.php"); }
}
else
{
//header("location:login.php");
echo "Password incorrecto!"; echo "<br>";
echo '<a href="http://localhost/login.php">Volver </a>';
}
}
?>
Y despues en cada pagina le pongo por ejemplo inicio.php
Código php:
Ver original<?php
echo '<center><b>Bienvenido, al Sistema </b></center>';
if (isset($_SESSION['login'])) { echo '<b>Usuario: </b>';
echo '<b>'.$_SESSION['login'].'</b>.';
echo '<p><a href="logout.php">Logout</a></p>';
?>
<html>
<input type="button" name="ok" value="ok" >
</html>
<?php
}else{
include("login.php");
}
?>
Bueno , espero les sirva, aparte esta bien simple !!!!!!!
Saludos, Ricardo !!!