Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/08/2006, 17:17
maurozone
 
Fecha de Ingreso: abril-2006
Mensajes: 119
Antigüedad: 18 años
Puntos: 0
[ AYUDA ] Tengo una problema con Cookies

Hola. Miren, estoy desarrollando un sistema de login. Pero, como siempre, yo tengo un error en algo y tengo que recurrir aca. Esta vez el problema es que no me reconoce las cookies. Miren este script:

Código PHP:
<? if (!($_COOKIE['uid'])){ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
    margin-left: 120px;
    margin-top: 65px;
}
-->
</style></head>

<body>
<table width="342" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="login">
  <!--DWLayoutTable-->
  <tr>
    <td height="23" colspan="2" align="center" valign="middle" bgcolor="#E8E8E8"><strong>UserCP Login </strong></td>
  </tr>
  <tr>
    <td width="210" height="29">&nbsp;</td>
    <td width="130">&nbsp;</td>
  </tr>
  <tr>
    <td height="182" valign="middle">
    <form id="form1" name="form1" method="post" action="usercp/login.php">
      <p>&nbsp;Username: 
        <label>
          <input name="username" type="text" class="login" id="username" />
          </label>
        </p>
        <p>&nbsp;Password:&nbsp;      
          <input name="password" type="text" class="login" id="password" />
        </p>
        <p align="center">
          <label>
          <input type="submit" name="Submit" value="Login" />
          </label>
        </p>
    </form></td>
    <td align="center" valign="middle"><img src="img/lock.jpg" width="120" height="139" /></td>
  </tr>
  <tr>
    <td height="35">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<? } else { 
    echo 
"Welcome, ".$_COOKIE[unick];
    echo 
"<a href='usercp/index.php'>Go to my UserCP</a><br />";
    echo 
"<a href='usercp/logout.php'>Logout</a>";
    }
    
?>
Me muestra el Formulario si la Cookie "uid" esta vacia. Sino, me manda abajo. Bueno, yo entro todo bien. Pero, cuando vuelvo al menu de login. Me muestra el formulario de nuevo, cuando no deberia. Miren, para saber si la cookie esta vacia uso esto:

Código PHP:
<? if (!($_COOKIE['uid'])){ ?>
No se porque no me funciona... Ayuda!. Gracias, MZ.-