Page 2 of 2

Re: A biscuit and a cup of tea (things from the past) (='.'=

Posted: Mon Apr 03, 2017 1:26 pm
by Lagi Pittas
Hi

I thought I was very explicit :oops:

What I am saying is instead of bothering to make the cookie expire use the value of the cookie to store the information you need.

So for all intents and purposes you could store the WORD "expired" or "visited z" as the value of the cookie when they go to page Z.

so they go to page a b c if the cookie doesn't exist you create it an print a message if it does exist on those pages you check to see the value of the cookie if it is empty you print a certain message
if it's not empty and the value is "VISITED Z" you set the value of the cookie to empty and change its expiry to today plus a year

if they go to page Z and there is a cookie you put the value "visited Z" (or "expired" or whatever).

I think we need a real example of why you want to expire the cookie then recreate it?

Regards Lagi

Re: A biscuit and a cup of tea (things from the past) (='.'=

Posted: Mon Apr 03, 2017 7:42 pm
by SparkOut
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;&nbsp;__" & cr into tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\&nbsp;&nbsp;,,)_" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'-\(&nbsp;/" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;|&nbsp;,\" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\|_/\\" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;_&nbsp;'.D" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp/&nbsp;/&nbsp;\&nbsp;|" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/_\ &nbsp;/_\" & cr after tElvisArt
put "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-&nbsp;&nbsp;&nbsp;&nbsp;'-</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

Re: A biscuit and a cup of tea (things from the past) (='.'=

Posted: Sat Apr 08, 2017 11:48 pm
by SparkOut
I hope Maria will come back before another 5 months go by...

Re: A biscuit and a cup of tea (things from the past) (='.'=

Posted: Mon Apr 10, 2017 11:34 am
by Mariasole
Excuse me SparkOut,
I was able to reconnect on the web today only (do you know that in Italy internet is a kind of luxury? :evil: ) and I found your post! :D
It works! It works! It works! :D :D :D
Now I start to study it to understand how you did, but what matters is that it works! 8)
There are no words, dear SparkOut to thank you for the commitment you have made to this solution and the effort you made to understand me!
I will pray for you a Rosary to thank you.
Were months and months and months I was looking for this solution!
You are a talented programmer and a great man and a true knight!
And you're also very nice! :wink:

Thank you very much!
Mariasole
(=^‥^=)

PS: Thank you, too Lagi! You'll explain it very well, but I have difficulty understanding English !!! :roll: