Ver Mensaje Individual
  #23 (permalink)  
Antiguo 29/09/2010, 16:13
web33
 
Fecha de Ingreso: septiembre-2010
Mensajes: 75
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Loginarse en PHP

Porfabor necesito ayuda.. lo estoy probando de todas las formas pero no puedo

al final he separao el codigo en 2 paginas pero NADA

Porfabor si sabes como solucionar esto ayudame please te lo agredezco mucho

Los dos codigos son:

index.php
<?php
include('config.php');
if(!isset($_SESSION['usuario']) )
{
echo '<form action="auten.php" method="POST">
Nick: <input type="text" name="nick" size="30"><br>
Password: <input type="password" name="pass" size="30" ><br>
<input type="submit" name="submit" value="Enviar"></form>';

}else{
echo 'Bienvenido '.$_SESSION[usuario];
echo '<br><a href=logout.php>Salir</a>';
}
?>

auten.php
<?php
include('config.php');
if( ($_POST[nick] == "") or ($_POST[pass] == "") )
{
echo "llena todos campsss";
}
else{

$usuarios=mysql_query("SELECT * FROM users WHERE nick='$_POST[nick]' and pass='$_POST[pass]' ");
if($user_ok = mysql_fetch_array($usuarios))
{
$_SESSION[usuario] = $user_ok["nick"];
$_SESSION[idusuario] = $user_ok["id"];

print "<meta http-equiv=Refresh content=\"2 ; url=index.php\">";

}else{
echo 'Nick y pass incorrectos';
}
}
?>


Porfabor espero tu respuesta