Hi
I have a problem with the loading of a page through the header function it seems.
If people login and their username is right the following file sends them a cookie and then redirects them to my.php. But my.php always gets stuck in the browser. It appears in the Address line of the browser but does not load the page. I have to go to the address line and hit enter. Then it loads the page. Am I missing something in the following file ?
<PRE>
<?php
require ("src/config.inc");
// Nothing is in the config file that would
//create a header error
$db = mysql_connect ("localhost", "user", "pass")
or die ("bla bla");
mysql_select_db ("db", $db);
$query = mysql_query("select * from my_user where username = '$username' AND password = '$password'");
$result = mysql_num_rows($query);
// User does not exist
if ($result == 0)
{
mysql_close();
echo "<FONT COLOR=\"#FF0000\"><DIV ALIGN=\"center\">Bla Bla</DIV></FONT>";
}
// User exists
else
{
$visitor = $username;
$datelog = date("YmdHis",time()+21600);
SetCookie("visitor",$visitor,time()+2864000);
SetCookie("lastlog",$datelog,time()+2864000);
header("Location: my.php");
exit;
}
?>
</PRE>
Thanks for any hint