Re: [PHP] Cookie Help

2001-08-13 Thread Richard Baskett

header(Set-Cookie: cookiemonster=$cookiedata; expires=$expire; path=/;
domain=domain.com, secure);

or go to http://home.netscape.com/newsref/std/cookie_spec.html to view even
more specs on it.  I just found this way of setting cookies to always work
compared to the php setcookie command which didnt always set on all
platforms and browsers.  I hope it helps!

Rick

 Hi, I have a problem with setting cookies...I am able to set cookies and
 retreive the information when using IE but not netscape. I'm not totally
 sure what the problem is. Here is the syntax that I am using, any
 suggestions are welcomed.
 
 $cookiedata = Mmmm;
 $time = mktime()+900;
 $expire = date(l, d-M-y H:i:s, ($time));
 setcookie(cookiemonster, $cookiedata, $expire, /, domain.com., 1);
 
 It needs to be secure, hence the 1. Also, I need the domain to be
 domain.com and it cannot be www.domain.com. Can anyone help me at all?
 Thanks!
 
 Max


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] cookie help

2001-07-24 Thread Rasmus Lerdorf

 in order to prevent my visitors from seeing more than one popup in less than
 120 second, I added this to my php page(index.php)
 --
 setcookie(popup,1,time()+120);
 if ($popup!=1)

   echo script src=http://www.peel.net/frames/PMNforce.js/script;
 }
 -

 When I reload index.php, i see popups everytime. I am pretty sure that I
 enabled cookies in IE and Netscape.

 Please help. thanks

Do you really think that people will have their system clocks set
accurately to within 120 seconds of your server's system clock?  Heck, you
are lucky if they have their clock set to the right year, never mind the
right date and time down to the minute.

To do this reliably, encode your system time in the cookie value and use
that to determine whether the cookie is valid.  And use a session cookie.
Like this:

$value = 1;
$time = time() + 120;
setcookie('popup',$time:$value);
if(isset($popup)) {
list($time,$value) = explode(':',$popup);
if($time  time()) $popup = false;
else $popup = true;
}

if($popup)
echo script src=http://www.peel.net/frames/PMNforce.js/script;

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] cookie help

2001-07-24 Thread McShen

thanks!

Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  in order to prevent my visitors from seeing more than one popup in less
than
  120 second, I added this to my php page(index.php)
  --
  setcookie(popup,1,time()+120);
  if ($popup!=1)
 
echo script src=http://www.peel.net/frames/PMNforce.js/script;
  }
  -
 
  When I reload index.php, i see popups everytime. I am pretty sure that I
  enabled cookies in IE and Netscape.
 
  Please help. thanks

 Do you really think that people will have their system clocks set
 accurately to within 120 seconds of your server's system clock?  Heck, you
 are lucky if they have their clock set to the right year, never mind the
 right date and time down to the minute.

 To do this reliably, encode your system time in the cookie value and use
 that to determine whether the cookie is valid.  And use a session cookie.
 Like this:

 $value = 1;
 $time = time() + 120;
 setcookie('popup',$time:$value);
 if(isset($popup)) {
 list($time,$value) = explode(':',$popup);
 if($time  time()) $popup = false;
 else $popup = true;
 }

 if($popup)
 echo script src=http://www.peel.net/frames/PMNforce.js/script;

 -Rasmus




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]