Hello again. I´ve got this code:
if ($submit=="Login") {
$Link = mysql_connect ($Host, $User, $Password);
mysql_select_db("$DBName") or dir ("Could not select database");
$Query = "select * from user where username='$username'";
$Result = mysql_db_query ($DBName, $Query, $Link);
while ($Row = mysql_fetch_array ($Result)) {
if ($Row["password"]==$password ) {
setcookie ("Permitido", "OK", time() + 3600);
print("<CENTER><font size=-1 face=Verdana>Cookie instalada con éxito.<br><br><a href=\"index.php\"><B>Ver administrador de carpetas</B></a></font></CENTER>");
} else {
print("<CENTER>Contraseña errónea.</CENTER>");
}
}
} elseif ($submit=="Logout") {
setcookie ("Permitido", "OK", time() - 3600);
print("<CENTER><font size=-1 face=Verdana>Fuiste deslogueado correctamente.<br><br><a href=\"index.php\"><B>Volver a loguearse</B></a></font></CENTER>");
}
if ($submit!="Login") {
if ($Permitido!="OK") {
Login ();
} elseif ($Permitido=="OK") { // He´s logged.
if ($submit!="Logout") { //He´s in.
Logout ();
}
}
}
It doesn´t seem to work. At least in Win XP, if it does affect. When I Login using the form it says that the cookie was ok, but when I try to access and see, for example, the logout function I can´t: I always go back to the Login page. Why may it happen?
Thanks in advance!