Hello friends, this is the first time that i deal with cookies, i'm creating only one cookie for my site. This is the problem i want to validate one thing in my main page, that the user will be able to just click once a link, so in my cookie i'll validate that with a 24 hour expiration time cookie, but everytime the user reloads the page it uploads the time for example (Saturday, February 19, 2011 3:20:26) should update into this (Sunday, February 20, 2011 3:20:26) and it does but everytime the page is reloaded the cookie expiration time keeps updating too, so i wonder if there's a way to fix the expiration time, to keep it static no matter how many times the page is reloaded?

P.D. I know that if you delete the cookie the user will be able to click again, but i've been commanded to do it with a cookie.

Here is my cookie code

setcookie("CCEM", 'y', time()+3600*24*1000,"/","127.0.0.1",0,0);

P.D.2 I know that it keeps updating 'cause i'm using FirePHP
Thanks in advanced!

Recommended Answers

All 2 Replies

I really sorry for the double posting, but really no one can help me?

Please at least give me a hint, your knowledge on this subject would help me tremendously appreciated.

Thanks again!

P.S. If you need that i post more code, i'll do it!

Member Avatar for diafol

Hey Mr Bee, why you buzzing around? Chill. 7 hours isn't cause for a bump.

Anyway,

A reload could be stopped with a ref to $_SERVER. A reload will result in no referer being set. Try this:

if(isset($_SERVER['HTTP_REFERER'])){
	
	echo $_SERVER['HTTP_REFERER'];
}else{
	
	echo "no ref";
}

Caveat: HTTP_REFERER isn't the most secure way of checking the referring page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.