Ok, i have gotten so far that first the check is done on wether there is a cookie present (users click a restricted button) and if not go to login.php with this code:
<?php
if ($DFOLogin=="")
{
header ("location: login.php");
}
elseif ($DFOLogin==$pw)
{
header ("location: securepages.htm");
}
else
{
header ("location: login.php");
}
?>
Now if I login, using a form with a post action to logincheck.php it check with the following code:
<?php
mysql_connect("localhost", "username", "password") or die ("cant connect");
mysql_select_db("databasename") or die ("cant change");
$result=mysql_query("SELECT * FROM members WHERE username='$Username'") or die ("cant do it");
$row=mysql_fetch_array($result);
{
if ($row['Password']==$Password)
{
$pw=($row["Password"]==$Password);
SetCookie("DFOLogin", "$pw", 0);
header ("location: securepages.htm");
}
else
header ("location: login.php");
}
It logs the user in, that works, but it doesn't set a cookie, when I click the restricted area button again it goes to the login.php again while it should directly go to the securepages.htm,
And well, it doesn't...what am i doing wrong here...
Help plz..and thx in advance