Cara Maria
I am also not sure what you are trying to achieve. However, these files should do what you want. I will send you a private message to a site where I have set up a series of test files for you to see what happens when you browse them - the scripts are set out below:
http://domain/path/mariaA.lc and
http://domain/path/mariaB.lc are identical pages, they will check for a cookie, tell you if there is no cookie set, and set one ready to go and see Elvis in the right places (A or B)
Code: Select all
<?lc
put $_COOKIE into tCookiesArray
if tCookiesArray is not an array or tCookiesArray["purr"] is empty then
--no "purr" cookie exists so set a year long cookie
put cookie "purr" for "/<your path here>/" on "<your domain here>" with "Elvis lives for another year at least" until (the seconds + 60 * 60 * 24 * 365)
--now a "purr" cookie exists, but it didn't when the user first visited so initialise the page as false for now
put false into tPurrCookieCheck
else
--the "purr" cookie must still be valid so we know this visitor is an Elvis afficionado
put true into tPurrCookieCheck
end if
put "<pre> G __" & cr into tElvisArt
put " \\ ,,)_" & cr after tElvisArt
put " \'-\( /" & cr after tElvisArt
put " \ | ,\" & cr after tElvisArt
put " \|_/\\" & cr after tElvisArt
put " / _ '.D" & cr after tElvisArt
put "  / / \ |" & cr after tElvisArt
put " /_\ /_\" & cr after tElvisArt
put " '- '-</pre>" & cr after tElvisArt
?>
<html>
<head>
</head>
<body>
<?lc
if tPurrCookieCheck is true then
put "You brought a cookie for the kitty to keep it purring, so you KNOW Elvis ain't dead!" & cr
put tElvisArt
else
put "You came here looking for Elvis but you didn't bring a cookie. You can have a cookie now, Elvis likes cookies and happy kitties."
end if
?>
<div><a href="mariaA.lc">Maria Page A</a><br /><br />
<a href="mariaB.lc">Maria Page B</a><br /><br />
<a href="mariaZ.lc">Bad Page Z</a><br /><br /></div>
</body>
</html>
The bad page
http://domain/path/mariaZ.lc will kill the cookie
Code: Select all
<?lc
put $_COOKIE into tCookiesArray
if tCookiesArray is not an array or tCookiesArray["purr"] is empty then
--no "purr" cookie exists so we don't have to delete the cookie
else
--the "purr" cookie was valid so we know this visitor is an Elvis afficionado BUT
--the page is NOT allowed and the cookie must be deleted
put cookie "purr" for "/<your path here>/" on "<your domain here>" with "You tried to find Elvis where you should not be looking" until (the seconds - 60 * 60 * 24 * 365)
end if
?>
<html>
<head>
</head>
<body>
<?lc
put "You tried to find Elvis in the wrong place. This is some hideous techno disco! You should go back to the happy kitty place."
?>
<div><a href="mariaA.lc">Maria Page A</a><br /><br />
<a href="mariaB.lc">Maria Page B</a><br /><br />
<a href="mariaZ.lc">Bad Page Z</a><br /><br /></div>
</body>
</html>
If this doesn't make it all clear for you then I don't know what you are trying to do at all, and you will need to explain,
all over againagainagain