
Originally Posted by
keyboard1333
The two codes are on different pages. If you don't have the cookie then you are redirected to the first page.
This will still give you problems-- I was looking at it for a while and I figured out what was bothering me:
PHP Code:
if(isset($_COOKIE['lastVisit'])){
// if user has the cookie,
header('location: indexthesecond.php');
// he gets redirected.
}else{
// if user does _not_ have the cookie,
$visit = $_COOKIE['lastVisit'];
// you try to set the variable $visit --to the value of the cookie.--
// this code will _never_ run if the cookie exists,
// so it will _always_ generate a warning.
// like "NOTICE - undefined variable: lastVisit ..."
}
I realize it's "just an example," but realize that if you don't understand something very well, it's difficult to create a useful example. It's usually much better to simply explain what you really want to do.
Bookmarks