I have a part of my webpage only for users where they have to insert username and password to get into the protect pages...I'd like to keep the username value for two issues:
To make sure when somebody access one webpage he has the cookie set (he is allowed on that page) and to put into "name" his username when he sends a message on the message board.
I used the following code but it didn't work:
if ($num != 0) { // if his username and password is ok
$cookie_name = "user";
$cookie_value = "$username";
$cookie_expire = "";
$cookie_domain = ".oleinvestimentos.f2s.com";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/" , $cookie_domain, 0);
} else {
header("Location: http://www.domain.com/error.htm");
exit;
}
And I was thinking that when I put the echo "$username"; on any page it would come with the username, but it doesn't...
Could anyone help me?
Thank you
Felipe Lopes