I m very much a newbie to php...but I dont understand why this script doesnt work... After i type in a correct username and password the page just reloads and looks the same again with empty fields for pass and username...Nothing happens..
anyone have an idea what could be wrong?
and is there a way that i can check if the cookie is set?
<?
if($login == "Login")
{
include("db_connection/db_connect.php");
$query = "select * from auth where user_name = '$user' and password = '$pass'";
$result = mysql_query($query, $db);
if(mysql_affected_rows() != 0)
{
setcookie("user[]", $user);
setcookie("user[]", $pass);
Header('Location: $PHP_SELF?login=0');
echo "cookie is set";
}
else
{
Header('Location: $PHP_SELF?error=no%20good&login=0');
}
}
if(!isset($HTTPS_COOKIE_VARS["user"]))
{
echo $error."<br>";
?>
<form action="<?$PHP_SELF?>" method=post>
user: <input type=text name=user><br>
pass: <input type=text name=pass><br>
<input type=submit name=login value=Login>
</form>
<?
}
else
{
echo "Welcome";
}
?>