i am desinging a member area.
users enters their username and password. i am checking the entries with login.php page. the login.php page is below.
$login = mysql_db_query($dbasename, "select memberid, memberlevel, name, surname from members where username='".htmlspecialchars($username)."' and password='".md5($password)."' and active='1'");
if (mysql_num_rows($login) == "1") {
$row = mysql_fetch_array($login);
setcookie("memberid", $row[memberid], time()+2592000);
$name = $row[name] . " " . $row[surname];
setcookie("name", $name, time()+2592000);
setcookie("siteid", md5($row[memberlevel]), time()+2592000);
//header("Location: default.php");
exit;
} else {
echo "error";
}
if the entries are correct i will set some cookies. and i will redirect the page to the default.php. after the redirecting action the cookies can not be set. i cannot read the cookies at default.php
if i don't redirect the login page the cookies sets. but if i redirect the page the cookies don't set.
how can i solve this problem?