Cookie problems
| From: | Jesse Binam | Date: | Tue, 12 Sep 2000 03:17:56 +0000 |
| Subject: | Cookie problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16271@lists.php.net to get a copy of this message | ||
Hello All,
This code snipplet is from the fine folks at phpwizard.net. I am trying to
modify it a bit to add another feature. I want to set a cookie that lasts
one week. So if they return it automatically shows them the poll results.
The problem I have is that index.htm always shows the poll as if to let them
vote. The poll script says "you have already voted! Click here..." Can
anyone tell me what simple thing I have overlooked here? Thanks.
phpPollCollector.php:
// check if cookie exists
if($PCDPoll == "1")
// cookie exists, invalidate this vote
$poll_voteValid = 0;
else
// cookie does not exist yet, set one now
setCookie("PCDPoll", "1", time()+604800, "/",
".pcdiscounters.com");
index.htm:
if($PCDPoll == "1")
poll_viewResults(1);
else
poll_generateUI(1, "http://www.pcdiscounters.com/index.htm");
Thanks,
Jess