Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Problem setting cookie on WP Questions WordPress


Once again I'm using this site to ask a question, not about WordPress, but about WP Questions itself.

If you go to this page, a cookie should be set on your browser:

[[LINK href=""]][[/LINK]]

However, it seems to me that no cookie is being set. Here is the code I'm using, does anyone see a flaw in the way I'm setting this cookie?

public function executeStatic($request)
setcookie ("haveYouSeenTheLandingPage", $request->getParameter('name'), time() + 100000000);

if (file_exists($this->userCustomizationPath . 'templates/static' . $request->getParameter('name') . '.php')) {
$fileAsString = file_get_contents($this->userCustomizationPath . 'templates/static' . $request->getParameter('name') . '.php');
} elseif (file_exists(sfConfig::get('sf_root_dir') . '/apps/contest/modules/page/templates/static' . $request->getParameter('name') . '.php')) {
$fileAsString = file_get_contents(sfConfig::get('sf_root_dir') . '/apps/contest/modules/page/templates/static' . $request->getParameter('name') . '.php');

if (!$fileAsString) $this->forward404();

$this->fileAsString = $fileAsString;

So a cookie named haveYouSeenTheLandingPage should be set with a value of "About".

Any thoughts about why this is failing? Or is it working for some of you? If so, what browsers?

Answers (2)


Peter Michael answers:

Works on FF4/Windows Vista

Peter Michael comments:

Also works on
- Safari 5.0.5
- Chrome 11.0.696.71
on Windows Vista

Lawrence Krubner comments:

Strange. I wonder why it doesn't work for me?

Anyway, thanks all for the feedback. Very useful.


Utkarsh Kukreti answers:

Works on FF4 / Windows 7