[PHP] Cookie use management

2012-05-24 Thread Lester Caine
Not directly a PHP problem, but since PHP tends to automatically create a 
session cookie I thought it appropriate to ask here first.


The European rules on asking permission to use cookies have been around for a 
year now, and very few sites seem to be worrying about it until now, but press 
coverage is flagging that the ICO in the UK will start 'prosecuting' next week. 
Not exactly what the ICO are saying themselves, as they would prefer that the 
BROWSERS defaulted to cookies being blocked generally, so every cookie action 
requires approval locally anyway. Session cookies could be claimed to be exempt, 
but with the increasing hidden use of Google Analytics or in my case Piwik, WE 
become responsible or all that activity and so a few 'commercial' sites are 
appearing offering chargeable services to manage this for you.


I've been trying to dig down through the google results to find anything open 
source that provides something easily bolted on to existing PHP sites to 
intercept cookie use before it actually happens. My reading of the rules would 
suggest that simply adding a session cookie is acceptable as long as the site 
identifies they are being used, but until there is some 'case law', actually 
practice is very grey? Pop-up is obviously out of the question since that can be 
blocked, and even javascript could be blocked so what can be relied on to 
'Obtain permission before using a cookie'?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie use management

2012-05-24 Thread Jeremiah Dodds
Lester Caine les...@lsces.co.uk writes:

 Not directly a PHP problem, but since PHP tends to automatically create a
 session cookie I thought it appropriate to ask here first.

I don't know about the rest of your post, but you can easily turn off
this behavior if it's present (unless you are using a rather poor host),
see http://www.php.net/manual/en/session.configuration.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie use management

2012-05-24 Thread Lester Caine

( Forgot email address :) )
Jeremiah Dodds wrote:

Lester Caineles...@lsces.co.uk  writes:


Not directly a PHP problem, but since PHP tends to automatically create a
session cookie I thought it appropriate to ask here first.


I don't know about the rest of your post, but you can easily turn off
this behavior if it's present (unless you are using a rather poor host),
see http://www.php.net/manual/en/session.configuration.php


That would probably fall under the ICO acceptance that they don't want people to 
feel that they simply have to switch site functionality off ;)


I'm doing the hosting, but many of the sites that I need to support we have not 
written the code which as a range of 'frameworks', so I'm trying to find 
something that can be added in easily - like the Piwik tracking - without having 
to rewrite the sites ...


I'm thinking I need to write my own module, but I can't believe that no-one has 
done it yet. Or perhaps they are all charging for the service :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie access with CLI

2010-06-14 Thread Richard Quadling
2010/6/13 David Česal da...@cesal.cz:
 Hello,

 I'm trying to access (from CLI) some website, where login is required.
 Please, is it possible to set/save some cookies first (login session
 information) and then access the website as logged user? All through CLI.



 Thank you very much for any information.



 David Cesal



Beside cURL, you can also use stream contexts to get/set the cookie
for subsequent requests.

http://docs.php.net/stream_context_create
http://docs.php.net/stream_get_meta_data
http://docs.php.net/manual/en/context.http.php

Essentially, you create a context when you send the data (this will
allow you to POST data for a file_get_contents() call).

Then you get the meta data from the response.

Then you put the cookie you received into the context you will use to
continue in communication.

If you set up the default context in this way, then you don't need to
supply the context to every file command.

See the user notes on file_get_contents regarding routing calls
through an NTLM proxy. By creating a default context, all my code was
routed through an NTML proxy. PHP didn't support NTLM authentication
when I wrote the note (not sure it does yet, but my requirement
changed).

By using a default context, I have 1 place to edit any code (in my
auto_prepend.php script).


Richard.

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie access with CLI

2010-06-14 Thread Richard Quadling
On 13 June 2010 17:34, Shawn McKenzie nos...@mckenzies.net wrote:
 On 06/13/2010 09:58 AM, David Česal wrote:
 Hello,

 I'm trying to access (from CLI) some website, where login is required.
 Please, is it possible to set/save some cookies first (login session
 information) and then access the website as logged user? All through CLI.



 Thank you very much for any information.



 David Cesal



 I'm almost positive you can do this with cURL and it should be fairly
 simple.  Check it out.

 http://php.net/manual/en/book.curl.php

 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie access with CLI

2010-06-13 Thread David Česal
Hello,

I'm trying to access (from CLI) some website, where login is required.
Please, is it possible to set/save some cookies first (login session
information) and then access the website as logged user? All through CLI.

 

Thank you very much for any information.

 

David Cesal



Re: [PHP] Cookie access with CLI

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 16:58 +0200, David Česal wrote:

 Hello,
 
 I'm trying to access (from CLI) some website, where login is required.
 Please, is it possible to set/save some cookies first (login session
 information) and then access the website as logged user? All through CLI.
 
  
 
 Thank you very much for any information.
 
  
 
 David Cesal
 


I don't believe cookies are available in a CLI script, they are a
construct of the browser/web server setup. Running PHP via the command
line is just like any other script over the command line.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Cookie access with CLI

2010-06-13 Thread Shawn McKenzie
On 06/13/2010 09:58 AM, David Česal wrote:
 Hello,
 
 I'm trying to access (from CLI) some website, where login is required.
 Please, is it possible to set/save some cookies first (login session
 information) and then access the website as logged user? All through CLI.
 
  
 
 Thank you very much for any information.
 
  
 
 David Cesal
 
 

I'm almost positive you can do this with cURL and it should be fairly
simple.  Check it out.

http://php.net/manual/en/book.curl.php

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie Quandary

2009-10-27 Thread Brian Dunning
I wrote some cookies for a whole bunch of site admins, but failed to  
set the path, so all the cookies are set to '/admin', which is not  
going to work for everything they need to do. They are also too long,  
set for 6 months.


I need to correct both issues, so I changed it to write cookies to '/'  
for 72 hours. I've checked my Safari, and I see that I have both  
cookies set: A long one for '/admin' and a short one for '/'. I'm  
worried that once the admins' short cookies run out, their browsers  
will pick up the longer lasting value for the '/admin' version of the  
cookie.


I want to kill everyones' '/admin' cookies, but I'm worried that some  
browsers might erase both cookies if I do this. Does anyone know if I  
can safely kill the '/admin' cookie without risking deletion of the  
'/' cookie?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Quandary

2009-10-27 Thread Ashley Sheridan
On Tue, 2009-10-27 at 10:35 -0700, Brian Dunning wrote:

 I wrote some cookies for a whole bunch of site admins, but failed to  
 set the path, so all the cookies are set to '/admin', which is not  
 going to work for everything they need to do. They are also too long,  
 set for 6 months.
 
 I need to correct both issues, so I changed it to write cookies to '/'  
 for 72 hours. I've checked my Safari, and I see that I have both  
 cookies set: A long one for '/admin' and a short one for '/'. I'm  
 worried that once the admins' short cookies run out, their browsers  
 will pick up the longer lasting value for the '/admin' version of the  
 cookie.
 
 I want to kill everyones' '/admin' cookies, but I'm worried that some  
 browsers might erase both cookies if I do this. Does anyone know if I  
 can safely kill the '/admin' cookie without risking deletion of the  
 '/' cookie?
 
 


Cookies are client-side. Do you mean session files?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Cookie Quandary

2009-10-27 Thread Brian Dunning
No, I'm talking about cookies, thus the references to pathnames and  
expirations.


On Oct 27, 2009, at 10:56 AM, Ashley Sheridan wrote:


Cookies are client-side. Do you mean session files?




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Quandary

2009-10-27 Thread Ashley Sheridan
On Tue, 2009-10-27 at 11:34 -0700, Brian Dunning wrote:

 No, I'm talking about cookies, thus the references to pathnames and  
 expirations.
 
 On Oct 27, 2009, at 10:56 AM, Ashley Sheridan wrote:
 
  Cookies are client-side. Do you mean session files?
 
 
 


How are you writing the cookies to a users local computer?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Cookie Quandary

2009-10-27 Thread John Black

Brian Dunning wrote:
I want to kill everyones' '/admin' cookies, but I'm worried that some 
browsers might erase both cookies if I do this. Does anyone know if I 
can safely kill the '/admin' cookie without risking deletion of the '/' 
cookie?


How about you store the data, expire both cookies then send the valid 
cookie back to the browser?


--
John
All truth is simple... is that not doubly a lie?
[Friedrich Nietzsche]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie Question

2009-01-17 Thread PHP
Hi,
I am trying to get a cookie to set in Internet Explorer 7, I have tried several 
different setcookie() configurations, this is the latest.
Yes, I read the manual and the user notes, but can't find anything specific 
about the different security levels in IE.

$szCookieName = MyCookie; 
$nID = 2;
$expireTime = 60*60;

setcookie($szCookieName, $nID, time()-$expireTime,/,www.mysite.com,false);

However, they all work, only if I have the Privacy slider set to low in IE's 
options.
As soon as I go up to medium, it will not work.

And it works fine with firefox.

The only difference I can see is that Medium Security adds the rule:

Restricts first-party cookies that save information that can be used to contact 
you without your implicit consent.

All I am storing is an integer value, why is IE seeing that as information that 
can contact you?

Thanks for any help.

Chris

Re: [PHP] Cookie Question

2009-01-17 Thread Török Alpár
2009/1/17 PHP php_l...@ibcnetwork.net

 Hi,
 I am trying to get a cookie to set in Internet Explorer 7, I have tried
 several different setcookie() configurations, this is the latest.
 Yes, I read the manual and the user notes, but can't find anything specific
 about the different security levels in IE.

 $szCookieName = MyCookie;
 $nID = 2;
 $expireTime = 60*60;

 setcookie($szCookieName, $nID, time()-$expireTime,/,www.mysite.com
 ,false);


   is there any reason that you set the expire in the past? That is usually
used to delete a cookie, not set it. I had many problems with IE in general,
but cookies were never a problem.




 However, they all work, only if I have the Privacy slider set to low in
 IE's options.
 As soon as I go up to medium, it will not work.

 And it works fine with firefox.

 The only difference I can see is that Medium Security adds the rule:

 Restricts first-party cookies that save information that can be used to
 contact you without your implicit consent.

 All I am storing is an integer value, why is IE seeing that as information
 that can contact you?

 Thanks for any help.

 Chris




-- 
Torok, Alpar Istvan


Re: [PHP] Cookie Question

2009-01-17 Thread PHP

Oops, copy and paste error, that is the cookie I was using to delete.

The one I am using to set is acutally:
setcookie($szCookieName, $nID, 
time()+$expireTime,/,www.mysite.com,false);





2009/1/17 PHP php_l...@ibcnetwork.net


Hi,
I am trying to get a cookie to set in Internet Explorer 7, I have tried
several different setcookie() configurations, this is the latest.
Yes, I read the manual and the user notes, but can't find anything 
specific

about the different security levels in IE.

$szCookieName = MyCookie;
$nID = 2;
$expireTime = 60*60;

setcookie($szCookieName, $nID, time()-$expireTime,/,www.mysite.com
,false);



  is there any reason that you set the expire in the past? That is usually
used to delete a cookie, not set it. I had many problems with IE in 
general,

but cookies were never a problem.





However, they all work, only if I have the Privacy slider set to low in
IE's options.
As soon as I go up to medium, it will not work.

And it works fine with firefox.

The only difference I can see is that Medium Security adds the rule:

Restricts first-party cookies that save information that can be used to
contact you without your implicit consent.

All I am storing is an integer value, why is IE seeing that as 
information

that can contact you?

Thanks for any help.

Chris





--
Torok, Alpar Istvan






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: 答复: 答复: [PHP]COOKIE or coding

2008-11-06 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2008 8:51 PM
 To: Zhao chunliang[chunliang.zhao]
 Cc: php-general@lists.php.net
 Subject: Re: 答复: 答复: [PHP]COOKIE or coding
 
 Zhao chunliang[chunliang.zhao] wrote:
 
  I'll use the string to decrypt, so that I want to they are the same.
 
  When I use 'urlencode', some other string will be changed. Like '/'
 
 see also http://php.net/rawurlencode

...and if you're only worried about '+' to ' ', just replace!

?php
$foo = 'asldkf1231Qasasdf 123/Q==';
$foo = str_replace(' ', '+', $foo);
echo $foo;
?

That code should output:

'asldkf1231Qasasdf+123/Q==

HTH,


Todd Boyd
Web Programmer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP]COOKIE or coding

2008-11-05 Thread Zhao chunliang[chunliang.zhao]
Dear: all 

   

   That is very abnormality. 

 

   1.Open the url : http://127.0.0.1/showCookie.php

ShowCookie.php   code: 

 ?php

   var_dump($_COOKIE);

 ? 

That's print:  

   [TCSPUBLICJAUTHM] =
USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==   

   

   2. The same window, input the string
javascript:alert(document.cookie); and enter, it's show :



   

   3. now , I change the showCookie.php 

 ?php

   echo scriptalert(' .
$_COOKIE['TCSPUBLICJAUTHM'] . ');/script;

   var_dump($_COOKIE);

 ? 

 That's print:



   

   I think the cookie in php being changed.   

  Look forward to your help

 

 



答复: [PHP]COOKIE or coding

2008-11-05 Thread Zhao chunliang[chunliang.zhao]
Dear: all 

   

   That is very abnormality. 

 

   1.Open the url : http://127.0.0.1/showCookie.php

ShowCookie.php   code: 

 ?php

   var_dump($_COOKIE);

 ? 

That's print:  

   [TCSPUBLICJAUTHM] =
USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==   

   

   2. The same window, input the string
javascript:alert(document.cookie); and enter, it's show :

   That's print: 

[TCSPUBLICJAUTHM] =
USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==   

 

   

   3. now , I change the showCookie.php 

 ?php

   echo scriptalert(' .
$_COOKIE['TCSPUBLICJAUTHM'] . ');/script;

   var_dump($_COOKIE);

 ? 

 That's print:

 [TCSPUBLICJAUTHM] =
USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==   

   

   

   I think the cookie in php being changed.   

  Look forward to your help

 

 



RE: [PHP]COOKIE or coding

2008-11-05 Thread Boyd, Todd M.
 -Original Message-
 From: Zhao chunliang[chunliang.zhao]
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2008 3:52 AM
 To: php-general@lists.php.net
 Subject: 答复: [PHP]COOKIE or coding
 
1.Open the url : http://127.0.0.1/showCookie.php
 
 ShowCookie.php   code:
 
  ?php
var_dump($_COOKIE);
  ?
 
 That's print:
[TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
 
2. The same window, input the string
 javascript:alert(document.cookie); and enter, it's show :
 
That's print:
 [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

Notice the +. In certain situations in PHP, it will be HTML Decoded. This 
means the + will turn into whitespace. Try this for an example:

index.php:
?php
  echo $_GET['d'];
?

Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it should 
display Hello World instead of Hello+World.

3. now , I change the showCookie.php
 
  ?php
echo scriptalert(' .
 $_COOKIE['TCSPUBLICJAUTHM'] . ');/script;
var_dump($_COOKIE);
  ?
 
  That's print:
  [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

As you can see, the only difference is the + has been replaced by whitespace.
 
I think the cookie in php being changed.

It is, but it's not as drastic as you would think. There is an expected 
behavior (+ to  ) that you can deal with in your algorithm via 
substitution, encoding, etc.

HTH,


Todd Boyd
Web Programmer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



答复: [PHP]COOKIE or coding

2008-11-05 Thread Zhao chunliang[chunliang.zhao]
First thanks for Todd 's help

I do have some questions.

1.Open the url : http://127.0.0.1/showCookie.php
ShowCookie.php   code:
?php
  echo scriptalert(' . $_COOKIE['TCSPUBLICJAUTHM'] .');/script; 
?
it's pop-up show :
[TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

2. The same window, input the string
   javascript:alert(document.cookie); and enter, 
it's pop-up show:
[TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

So, I think it's being changed by PHP, not be HTML Decoded by Browser.

And the string in Cookie , we should be reluctant to change.








 -Original Message-
 From: Zhao chunliang[chunliang.zhao]
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2008 3:52 AM
 To: php-general@lists.php.net
 Subject: 答复: [PHP]COOKIE or coding
 
1.Open the url : http://127.0.0.1/showCookie.php
 
 ShowCookie.php   code:
 
  ?php
var_dump($_COOKIE);
  ?
 
 That's print:
[TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
 
2. The same window, input the string
 javascript:alert(document.cookie); and enter, it's show :
 
That's print:
 [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

Notice the +. In certain situations in PHP, it will be HTML Decoded. This
means the + will turn into whitespace. Try this for an example:

index.php:
?php
  echo $_GET['d'];
?

Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
should display Hello World instead of Hello+World.

3. now , I change the showCookie.php
 
  ?php
echo scriptalert(' .
 $_COOKIE['TCSPUBLICJAUTHM'] . ');/script;
var_dump($_COOKIE);
  ?
 
  That's print:
  [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

As you can see, the only difference is the + has been replaced by
whitespace.
 
I think the cookie in php being changed.

It is, but it's not as drastic as you would think. There is an expected
behavior (+ to  ) that you can deal with in your algorithm via
substitution, encoding, etc.

HTH,


Todd Boyd
Web Programmer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: 答复: [PHP]COOKIE or coding

2008-11-05 Thread Micah Gersten
As Todd said, PHP is decoding the URL encoded cookie. The cookie has a
'+' in it, because the HTTP headers cannot submit a space. That's why
when you use Javascript, it shows you what's in the cookie, but when you
use PHP, it shows the space. Which behavior do you prefer? If you want
to see the +, the use this:
http://us3.php.net/urlencode

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Zhao chunliang[chunliang.zhao] wrote:
 First thanks for Todd 's help

   I do have some questions.

   1.Open the url : http://127.0.0.1/showCookie.php
 ShowCookie.php   code:
   ?php
   echo scriptalert(' . $_COOKIE['TCSPUBLICJAUTHM'] .');/script; 
   ?
   it's pop-up show :
   [TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

   2. The same window, input the string
javascript:alert(document.cookie); and enter, 
   it's pop-up show:
   [TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

 So, I think it's being changed by PHP, not be HTML Decoded by Browser.

 And the string in Cookie , we should be reluctant to change.








   
 -Original Message-
 From: Zhao chunliang[chunliang.zhao]
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2008 3:52 AM
 To: php-general@lists.php.net
 Subject: 答复: [PHP]COOKIE or coding

1.Open the url : http://127.0.0.1/showCookie.php

 ShowCookie.php   code:

  ?php
var_dump($_COOKIE);
  ?

 That's print:
[TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

2. The same window, input the string
 javascript:alert(document.cookie); and enter, it's show :

That's print:
 [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
 

 Notice the +. In certain situations in PHP, it will be HTML Decoded. This
 means the + will turn into whitespace. Try this for an example:

 index.php:
 ?php
   echo $_GET['d'];
 ?

 Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
 should display Hello World instead of Hello+World.

   
3. now , I change the showCookie.php

  ?php
echo scriptalert(' .
 $_COOKIE['TCSPUBLICJAUTHM'] . ');/script;
var_dump($_COOKIE);
  ?

  That's print:
  [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
 

 As you can see, the only difference is the + has been replaced by
 whitespace.
  
   
I think the cookie in php being changed.
 

 It is, but it's not as drastic as you would think. There is an expected
 behavior (+ to  ) that you can deal with in your algorithm via
 substitution, encoding, etc.

 HTH,


 Todd Boyd
 Web Programmer

   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



答复: 答复: [PHP]COOKIE or coding

2008-11-05 Thread Zhao chunliang[chunliang.zhao]

I'll use the string to decrypt, so that I want to they are the same.

When I use 'urlencode', some other string will be changed. Like '/'


Thanks very much!!



 -Original Message-
As Todd said, PHP is decoding the URL encoded cookie. The cookie has a
'+' in it, because the HTTP headers cannot submit a space. That's why
when you use Javascript, it shows you what's in the cookie, but when you
use PHP, it shows the space. Which behavior do you prefer? If you want
to see the +, the use this:
http://us3.php.net/urlencode

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Zhao chunliang[chunliang.zhao] wrote:
 First thanks for Todd 's help

   I do have some questions.

   1.Open the url : http://127.0.0.1/showCookie.php
 ShowCookie.php   code:
   ?php
   echo scriptalert(' . $_COOKIE['TCSPUBLICJAUTHM']
.');/script; 
   ?
   it's pop-up show :
   [TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

   2. The same window, input the string
javascript:alert(document.cookie); and enter, 
   it's pop-up show:
   [TCSPUBLICJAUTHM] = USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

 So, I think it's being changed by PHP, not be HTML Decoded by Browser.

 And the string in Cookie , we should be reluctant to change.








   
 -Original Message-
 From: Zhao chunliang[chunliang.zhao]
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 05, 2008 3:52 AM
 To: php-general@lists.php.net
 Subject: 答复: [PHP]COOKIE or coding

1.Open the url : http://127.0.0.1/showCookie.php

 ShowCookie.php   code:

  ?php
var_dump($_COOKIE);
  ?

 That's print:
[TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

2. The same window, input the string
 javascript:alert(document.cookie); and enter, it's show :

That's print:
 [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
 

 Notice the +. In certain situations in PHP, it will be HTML Decoded.
This
 means the + will turn into whitespace. Try this for an example:

 index.php:
 ?php
   echo $_GET['d'];
 ?

 Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
 should display Hello World instead of Hello+World.

   
3. now , I change the showCookie.php

  ?php
echo scriptalert(' .
 $_COOKIE['TCSPUBLICJAUTHM'] . ');/script;
var_dump($_COOKIE);
  ?

  That's print:
  [TCSPUBLICJAUTHM] =
 USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
 

 As you can see, the only difference is the + has been replaced by
 whitespace.
  
   
I think the cookie in php being changed.
 

 It is, but it's not as drastic as you would think. There is an expected
 behavior (+ to  ) that you can deal with in your algorithm via
 substitution, encoding, etc.

 HTH,


 Todd Boyd
 Web Programmer

   


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: 答复: 答复: [PHP]COOKIE or coding

2008-11-05 Thread Chris
Zhao chunliang[chunliang.zhao] wrote:
   
 I'll use the string to decrypt, so that I want to they are the same.
 
 When I use 'urlencode', some other string will be changed. Like '/'

see also http://php.net/rawurlencode

-- 
Postgresql  php tutorials
http://www.designmagick.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] cookie encoding/decoding

2008-07-11 Thread Jeff Demel
Anyone have any ideas on this at all?

-Original Message-
From: Jeff Demel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 10:50 AM
To: php-general@lists.php.net
Subject: [PHP] cookie encoding/decoding

I have a situation where a cookie is being set elsewhere on a site by
ASP.NET, and I want to read it in my PHP.  However, when getting a cookie in
PHP, it does an automatic urldecode (or some kind of decoding).  Since the
cookie is entered in its pure form, with no encoding, on the ASP.NET side,
PHP is actually converting/decoding correct characters that don't need
decoding.  So, for example a plus sign would become a blank space.  This, of
course, means I'm getting incorrect info from the cookie.

Is there a way to turn off this PHP feature?  Perhaps a flag in the .ini
file?

-Jeff



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie encoding/decoding

2008-07-10 Thread Jeff Demel
I have a situation where a cookie is being set elsewhere on a site by
ASP.NET, and I want to read it in my PHP.  However, when getting a cookie in
PHP, it does an automatic urldecode (or some kind of decoding).  Since the
cookie is entered in its pure form, with no encoding, on the ASP.NET side,
PHP is actually converting/decoding correct characters that don't need
decoding.  So, for example a plus sign would become a blank space.  This, of
course, means I'm getting incorrect info from the cookie.

Is there a way to turn off this PHP feature?  Perhaps a flag in the .ini
file?

-Jeff



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread tedd

Mark:

You said:


 I'm gonna shit and go blind cause I haven't got a clue...


and


 The only thing preventing me from gouging out my eyes right now is ...


Are you sure that programming is right for you?

It sounds like you're going to hurt yourself.  This was just a cookie.  :-)

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread Mark Weaver

tedd wrote:

Mark:

You said:


 I'm gonna shit and go blind cause I haven't got a clue...


and


 The only thing preventing me from gouging out my eyes right now is ...


Are you sure that programming is right for you?

It sounds like you're going to hurt yourself.  This was just a cookie.  :-)

Cheers,

tedd


There's an old proverb that basically says that if you present a mule 
with two choices, (1) a easy, meandering path up the side of a mountain 
that triples the time it would take to get to the top, and (2) a 
brutally hard path that goes straight up the mountain, but would most 
certainly have a good chance of killing the mule if taken, the mule will 
take path number 2 each and every time.


It's the mule in me!  :)  I can't help myself. It's like sitting a pair 
of shoes down in front of a leprechaun; he can't resist the compulsion 
the shine and clean those shoes. I can't resist the compulsion to solve 
a problem by coding a solution for it.


I really enjoy programming. It satisfies a creative bent in me, but from 
time to time I do get very frustrated with it. Especially when, as in 
this case, it's only a cookie and an easy concept. What frustrates me is 
I know I'm missing something, but for the life of me I can't see it. 
Therefore the shoe that I'm compelled to clean and shine keeps dipping 
itself back into the mud.


For me moving from procedural PERL programming to OOP PHP feels like a 
paradigm shift! some of it coming back easily and some of it not so 
easily. Ya know... old dog new tricks... that sort of thing. But if I 
don't challenge myself and learn new things I could run the risk of 
getting stuck in a rut of thinking the same way about things and well... 
never mind... shit! more mud on that shoe again.  :)


--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread tedd

At 8:37 AM -0400 3/26/08, Mark Weaver wrote:
I really enjoy programming. It satisfies a creative bent in me, but 
from time to time I do get very frustrated with it. Especially when, 
as in this case, it's only a cookie and an easy concept. What 
frustrates me is I know I'm missing something, but for the life of 
me I can't see it. Therefore the shoe that I'm compelled to clean 
and shine keeps dipping itself back into the mud.


Well, if it's any solace to you I remember facing the same problem 
and finally resorted to a refresh. But it did slow me down a bit.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread Richard Lynch
On Tue, March 25, 2008 8:11 pm, Mark Weaver wrote:
 I suspect I already know part of the answer to this, but I'm not sure
 which way to go with it. I've got a project I'm working on and one of
 the things it's got to do is set cookies and then read them later.
 When
 the app was first written I was doing everything in PERL and cookies
 are
 fairly straight-forward, however I'm finding cookies in PHP somewhat
 problematic.

 Setting the cookie is a snap, however getting the info back out is,
 well... problematic.

 this is basically what I'm doing, what I'm seeing in the cookie, and
 what I'm getting back out.

 Setting the cookie
 ==
 $values = blah|blah|blah;
 setcookie(cookiename, $values, time()+$timevalue);

Because IE engineers CANNOT READ a technical document to save their
lives, you MUST supply a path if you supply a time:

setcookie(cookiename, $values, time() + $timevalue, /);

You also don't tell use what $timevalue is, so that could be something
very wrong... :-)

 Inside the Cookie
 ==
 Content: blah%7Cblah%7Cblah


 Getting info Out Of Cookie
 ==
 list($first,$second,$third) = explode(|, $values);

Unless you have register_globals set to ON (bad!) then $values will
only have meaning in the setcookie script...

 Cookie Test Page
 ==
 if (isset($_COOKIE[cookiename])){
   list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
   echo pI found your cookie/p\n;
   echo pThe following Values were Contained in the cookie:BR
 Username: $firstBR
 Password: $secondBR
 Type: $third/p\n;

You should NOT NOT NOT NOT NOT be storing a username *or* password in
a cookie!!!

 }
 else{
   echo pI wasn't able to find your cookie./p\n;
 }

 Now, I've constructed a cookie_test.php page to check things out and
 the
 strange behavior I'm seeing is, upon first execution I get the else
 block, but if I hit the browser's reload button I get the if block.
 At
 first I thought the cookie wasn't being read at all because of weird
 characters, but then upon reloading the page and seeing the if block
 being displayed I'm thoroughly confused. It's gotta something simple
 I'm
 missing.

What *is* in your cookies?

var_dump($_COOKIES);

Perhaps putting '|' in there is not a valid character?

You could base64 encode it or ...

 and I swear if someone tells me to RTFM I'm gonna shit and go blind
 cause I haven't got a clue as to which part of the FM to read
 concerning this. :)

It would be some chunk of the Netscape Cookie spec.

Google for Netscape Cookie spec and read that.  It's only a page.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread Daniel Brown
On Tue, Mar 25, 2008 at 9:49 PM, Andrew Ballard [EMAIL PROTECTED] wrote:
 On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown [EMAIL PROTECTED] wrote:
  
   Is this block of code executed immediately after the cookie is
set?  Sometimes PHP works too fast for its own good and the client
doesn't even realize it has a cookie yet.  Try setting it with one
page and either sleep()'ing for a bit or forcing a link-click or page
refresh before checking for the cookie.

  Um... Cookie data ISN'T available to the same script that sets it. If
  you use setcookie(), all it does is send a header to the browser
  immediately ahead of the output of your script telling the browser to
  store those values in either memory or on disk. The value will not
  appear in the $_COOKIE array until the browser requests the next page
  and includes the Cookie: header as part of the request.

You're correct. I was saying basically the same thing, but
re-reading it, it sure doesn't look like it in English.  ;-P

The sentences should've instead been rewritten like so:
Try setting it with one page and forcing a link-click or
sleep()'ing for a bit and then refreshing.

It wasn't meant to insinuate

-- 
/Daniel P. Brown
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-26 Thread Daniel Brown
On Tue, Mar 25, 2008 at 10:22 PM, Mark Weaver [EMAIL PROTECTED] wrote:

  Geez! now my $_SESSION isn't persisting to the next page when the screen
  refreshes. The only thing preventing me from gouging out my eyes right
  now is that I know I'll get this stuff. It's just a matter of time...

Sessions are only good on the same server as which they were set.
This is because the server writes the data to a file on its side, then
sends just a session ID cookie to the browser.  This session ID holds
no information except the key to the session file on the server with
which it's associated.

However, if you're still on the same server, make sure that you've
used session_start() at the top of every page to which you want the
session to carry over.

EXAMPLE:

Page1session_start() is used and the UID of the visitor is set.
Page 2   session_start() is used, but no data is read/written.
Page 3   session_start() is NOT used, no $_SESSION data available.
Page 4   session_start() is used, and is re-initialized despite missing Page 3.

-- 
/Daniel P. Brown
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Hi all,

I suspect I already know part of the answer to this, but I'm not sure 
which way to go with it. I've got a project I'm working on and one of 
the things it's got to do is set cookies and then read them later. When 
the app was first written I was doing everything in PERL and cookies are 
fairly straight-forward, however I'm finding cookies in PHP somewhat 
problematic.


Setting the cookie is a snap, however getting the info back out is, 
well... problematic.


this is basically what I'm doing, what I'm seeing in the cookie, and 
what I'm getting back out.


Setting the cookie
==
$values = blah|blah|blah;
setcookie(cookiename, $values, time()+$timevalue);


Inside the Cookie
==
Content: blah%7Cblah%7Cblah


Getting info Out Of Cookie
==
list($first,$second,$third) = explode(|, $values);


Cookie Test Page
==
if (isset($_COOKIE[cookiename])){
list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
echo pI found your cookie/p\n;
echo pThe following Values were Contained in the cookie:BR
  Username: $firstBR
  Password: $secondBR
  Type: $third/p\n;
}
else{
echo pI wasn't able to find your cookie./p\n;
}

Now, I've constructed a cookie_test.php page to check things out and the 
strange behavior I'm seeing is, upon first execution I get the else 
block, but if I hit the browser's reload button I get the if block. At 
first I thought the cookie wasn't being read at all because of weird 
characters, but then upon reloading the page and seeing the if block 
being displayed I'm thoroughly confused. It's gotta something simple I'm 
missing.


and I swear if someone tells me to RTFM I'm gonna shit and go blind 
cause I haven't got a clue as to which part of the FM to read 
concerning this. :)


thanks,

--
Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver [EMAIL PROTECTED] wrote:
   Hi all,
  [snip!]

 
Cookie Test Page
==
if (isset($_COOKIE[cookiename])){
   list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
   echo pI found your cookie/p\n;
   echo pThe following Values were Contained in the cookie:BR
 Username: $firstBR
 Password: $secondBR
 Type: $third/p\n;
}
else{
   echo pI wasn't able to find your cookie./p\n;
}
  
Now, I've constructed a cookie_test.php page to check things out and the
strange behavior I'm seeing is, upon first execution I get the else
block, but if I hit the browser's reload button I get the if block. At
first I thought the cookie wasn't being read at all because of weird
characters, but then upon reloading the page and seeing the if block
being displayed I'm thoroughly confused. It's gotta something simple I'm
missing.

 Is this block of code executed immediately after the cookie is
  set?  Sometimes PHP works too fast for its own good and the client
  doesn't even realize it has a cookie yet.  Try setting it with one
  page and either sleep()'ing for a bit or forcing a link-click or page
  refresh before checking for the cookie.


Um... Cookie data ISN'T available to the same script that sets it. If
you use setcookie(), all it does is send a header to the browser
immediately ahead of the output of your script telling the browser to
store those values in either memory or on disk. The value will not
appear in the $_COOKIE array until the browser requests the next page
and includes the Cookie: header as part of the request.

The part of the manual that applies is this line:

Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.

$_SESSION variables are available immediately as soon as you set them.
The session cookie still isn't set on the client until the browser
processes the response headers at the end of the transaction, but the
values are already in the array and, if the session cookie works they
will be accessible on successive requests.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Casey

On Mar 25, 2008, at 6:11 PM, Mark Weaver [EMAIL PROTECTED] wrote:


Hi all,

I suspect I already know part of the answer to this, but I'm not  
sure which way to go with it. I've got a project I'm working on and  
one of the things it's got to do is set cookies and then read them  
later. When the app was first written I was doing everything in PERL  
and cookies are fairly straight-forward, however I'm finding cookies  
in PHP somewhat problematic.


Setting the cookie is a snap, however getting the info back out is,  
well... problematic.


this is basically what I'm doing, what I'm seeing in the cookie, and  
what I'm getting back out.


Setting the cookie
==
$values = blah|blah|blah;
setcookie(cookiename, $values, time()+$timevalue);


Inside the Cookie
==
Content: blah%7Cblah%7Cblah


Getting info Out Of Cookie
==
list($first,$second,$third) = explode(|, $values);


Cookie Test Page
==
if (isset($_COOKIE[cookiename])){
   list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
   echo pI found your cookie/p\n;
   echo pThe following Values were Contained in the cookie:BR
 Username: $firstBR
 Password: $secondBR
 Type: $third/p\n;
}
else{
   echo pI wasn't able to find your cookie./p\n;
}

Now, I've constructed a cookie_test.php page to check things out and  
the strange behavior I'm seeing is, upon first execution I get the  
else block, but if I hit the browser's reload button I get the  
if block. At first I thought the cookie wasn't being read at all  
because of weird characters, but then upon reloading the page and  
seeing the if block being displayed I'm thoroughly confused. It's  
gotta something simple I'm missing.


and I swear if someone tells me to RTFM I'm gonna shit and go blind  
cause I haven't got a clue as to which part of the FM to read  
concerning this. :)


thanks,

--
Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Did you forget the ?php ? tags?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Daniel Brown
On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver [EMAIL PROTECTED] wrote:
 Hi all,
[snip!]

  Cookie Test Page
  ==
  if (isset($_COOKIE[cookiename])){
 list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
 echo pI found your cookie/p\n;
 echo pThe following Values were Contained in the cookie:BR
   Username: $firstBR
   Password: $secondBR
   Type: $third/p\n;
  }
  else{
 echo pI wasn't able to find your cookie./p\n;
  }

  Now, I've constructed a cookie_test.php page to check things out and the
  strange behavior I'm seeing is, upon first execution I get the else
  block, but if I hit the browser's reload button I get the if block. At
  first I thought the cookie wasn't being read at all because of weird
  characters, but then upon reloading the page and seeing the if block
  being displayed I'm thoroughly confused. It's gotta something simple I'm
  missing.

Is this block of code executed immediately after the cookie is
set?  Sometimes PHP works too fast for its own good and the client
doesn't even realize it has a cookie yet.  Try setting it with one
page and either sleep()'ing for a bit or forcing a link-click or page
refresh before checking for the cookie.

Conversely, $_SESSION data is much quicker, since the PHPSESSID
cookie is sent as soon as you initialize the session
(session_start()), and you can then immediately access the variables.

Proof-of-concept:
?php
// session-test.php
session_start();
$_SESSION['test'] = This is only a test.;
echo $_SESSION['test'].br /\n;
?

?php
// cookie-test.php
setcookie(cookiename,This is a cookie test.,time()+86400);
echo $_COOKIE['cookiename'].br /\n;
?


-- 
/Daniel P. Brown
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown [EMAIL PROTECTED] wrote:

On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver [EMAIL PROTECTED] wrote:
  Hi all,
 [snip!]

   Cookie Test Page
   ==
   if (isset($_COOKIE[cookiename])){
  list($first,$second,$third) = explode('|',$_COOKIE[cookiename]);
  echo pI found your cookie/p\n;
  echo pThe following Values were Contained in the cookie:BR
Username: $firstBR
Password: $secondBR
Type: $third/p\n;
   }
   else{
  echo pI wasn't able to find your cookie./p\n;
   }
 
   Now, I've constructed a cookie_test.php page to check things out and the
   strange behavior I'm seeing is, upon first execution I get the else
   block, but if I hit the browser's reload button I get the if block. At
   first I thought the cookie wasn't being read at all because of weird
   characters, but then upon reloading the page and seeing the if block
   being displayed I'm thoroughly confused. It's gotta something simple I'm
   missing.

Is this block of code executed immediately after the cookie is
 set?  Sometimes PHP works too fast for its own good and the client
 doesn't even realize it has a cookie yet.  Try setting it with one
 page and either sleep()'ing for a bit or forcing a link-click or page
 refresh before checking for the cookie.



Um... Cookie data ISN'T available to the same script that sets it. If
you use setcookie(), all it does is send a header to the browser
immediately ahead of the output of your script telling the browser to
store those values in either memory or on disk. The value will not
appear in the $_COOKIE array until the browser requests the next page
and includes the Cookie: header as part of the request.

The part of the manual that applies is this line:

Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.

$_SESSION variables are available immediately as soon as you set them.
The session cookie still isn't set on the client until the browser
processes the response headers at the end of the transaction, but the
values are already in the array and, if the session cookie works they
will be accessible on successive requests.

Andrew



Thank you Andrew... Now it all makes perfect sense. Good grief! there's 
so much to learn. It seems that Java was easier. ;)


--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED] wrote:
  Thank you Andrew... Now it all makes perfect sense. Good grief! there's
  so much to learn. It seems that Java was easier. ;)

That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Casey
On Mar 25, 2008, at 7:12 PM, Andrew Ballard [EMAIL PROTECTED]  
wrote:


On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED]  
wrote:
Thank you Andrew... Now it all makes perfect sense. Good grief!  
there's

so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



JavaScript, but that's already on the client. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED] wrote:

 Thank you Andrew... Now it all makes perfect sense. Good grief! there's
 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this in 
PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the screen 
refreshes. The only thing preventing me from gouging out my eyes right 
now is that I know I'll get this stuff. It's just a matter of time...


--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 10:19 PM, Casey [EMAIL PROTECTED] wrote:
 On Mar 25, 2008, at 7:12 PM, Andrew Ballard [EMAIL PROTECTED]
  wrote:



   On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED]
   wrote:
   Thank you Andrew... Now it all makes perfect sense. Good grief!
   there's
   so much to learn. It seems that Java was easier. ;)
  
   That's not specific to PHP. It's just how http works, so it's the same
   for ASP, Perl, I suspect Java and most (if not all) other languages.
   There might be a language that sets a cookie when you assign a value
   to a special cookie variable, but I'm not familiar with any.
  
   Andrew
  

  JavaScript, but that's already on the client.

True, client-side JavaScript would do it. I'm pretty sure that
server-side still would not though.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Jim Lucas

Mark Weaver wrote:

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED] wrote:

 Thank you Andrew... Now it all makes perfect sense. Good grief! there's
 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this in 
PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the screen 
refreshes. The only thing preventing me from gouging out my eyes right 
now is that I know I'll get this stuff. It's just a matter of time...




The problem that you are encountering is because the $_COOKIE array is 
populated when the script is executed.  More then likely the other 
languages that you used, would allow you to set a cookie and then they 
would enter them into the global array for you, and not make you wait 
until the next page load.


You could accomplish this yourself by making a wrapper function for the 
setcookie() function and have your function set the data using 
setcookie() and having it enter the data directly into the $_COOKIE array.


Something like this should do the trick

?php
/*
bool setcookie ( string $name
  [, string $value
  [, int $expire
  [, string $path
  [, string $domain
  [, bool $secure
  [, bool $httponly  ]] )
*/

function mySetCookie($name,
 $value=null,
 $expire=0,
 $path='/',
 $domain=null,
 $secure=FALSE,
 $httponly=FALSE) {

if ( is_null($domain) )
$domain = $_SERVER['SERVER_NAME'];

if ( setcookie( $name, $value, $expire,
$path, $domain, $secure, $httponly) ) {
$_COOKIE[$name] = $value;
return true;
}
return false;
}


?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Jim Lucas wrote:

Mark Weaver wrote:

Andrew Ballard wrote:
On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver [EMAIL PROTECTED] 
wrote:
 Thank you Andrew... Now it all makes perfect sense. Good grief! 
there's

 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this 
in PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the 
screen refreshes. The only thing preventing me from gouging out my 
eyes right now is that I know I'll get this stuff. It's just a matter 
of time...




The problem that you are encountering is because the $_COOKIE array is 
populated when the script is executed.  More then likely the other 
languages that you used, would allow you to set a cookie and then they 
would enter them into the global array for you, and not make you wait 
until the next page load.


You could accomplish this yourself by making a wrapper function for the 
setcookie() function and have your function set the data using 
setcookie() and having it enter the data directly into the $_COOKIE array.


Something like this should do the trick

?php
/*
bool setcookie ( string $name
  [, string $value
  [, int $expire
  [, string $path
  [, string $domain
  [, bool $secure
  [, bool $httponly  ]] )
*/

function mySetCookie($name,
 $value=null,
 $expire=0,
 $path='/',
 $domain=null,
 $secure=FALSE,
 $httponly=FALSE) {

if ( is_null($domain) )
$domain = $_SERVER['SERVER_NAME'];

if ( setcookie( $name, $value, $expire,
$path, $domain, $secure, $httponly) ) {
$_COOKIE[$name] = $value;
return true;
}
return false;
}


?


Wow! very sweet!!

Thank you Jim. I'm getting my brain good and wrinkled today.

--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Variables Maxing Out Using IE6

2006-08-18 Thread Richard Lynch
Set your session time out to, oh, 2 years or less (as in the spec,
they are gonna ignore you if you try more than 2 years).

You could even set *ONE* cookie with all the values serialized in an
array, and probably stay under the 4K limit.

Then you get people like me who, if a cookie value looks TOO funky,
I'll reject it, on the assumption that you are exposing my personal
info to your advertising sites for user-tracking.

Buh-bye.

Try to think about your cookies from the perspective of a paranoid
media-believing moron.

Like that movie with Mel Gibson, sort of...

Because SOME of your visitors are that weird, self included.

:-)

You can store a Cookie to ID me with something I know is me, and
then you know who I am for the next 2 years.  That should be good
enough.

Read the PHP session pages, and the setcookie page, and work out
what's best for you, with the paranoid user visitor mentality above.

On Thu, August 17, 2006 9:20 am, [EMAIL PROTECTED] wrote:

 On Wed, August 16, 2006 9:00 am, [EMAIL PROTECTED] wrote:
 Does IE6 limit somehow/somewhere the number of cookie variables I
 can
 create and store?

 Richard Lynch responded:
 Yes.

 Read the Cookie spec.

 There's no need for any site to ever send more than ONE Cookie
 anyway.

 Just use session_start() and you can store all the stuff in
 $_SESSION
 and it's all tied to the one Cookie.

 Users like me who set the browser to prompt for Cookies will often
 LEAVE a site that is being stupid and sending too many cookies,
 unless
 we really really really need your content, which is unlikely.

 So you're calling my app stupid, Richard?? lol

 To clarify, the app is for a small group of known users on an
 intranet, and
 yes, they really really need the content. There are 24 check boxes,
 and
 each selection triggers a graphical display of radiation levels in a
 specific area over the last hour. Since the active areas - 12 to 15
 usually
 -  don't change all that much over time, I thought it would make sense
 to
 have the app remember which boxes had been checked at last launch. I
 didn't like the idea of using cookies, so I actually have a database
 solution in place. But I've not dealt much with cookies, and I had
 some
 time and tried to use them to solve the problem. That's when I ran
 into the
 20 cookie limit with IE (Having just read the spec, I'm surprised that
 Microsoft has actually followed it).

 Unless there's something basic about $_SESSION variables I've missed,
 I
 don't believe they would work here. I need to track and remember which
 boxes are checked between sessions, not within a single session.
 Someone
 please correct me if I'm mistaken.

 Thanks again to Adam Zey for suggesting I serialize the cookie data.
 That
 solved the problem.

 David





-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Variables Maxing Out Using IE6

2006-08-17 Thread dpgirago

On Wed, August 16, 2006 9:00 am, [EMAIL PROTECTED] wrote:
 Does IE6 limit somehow/somewhere the number of cookie variables I can
 create and store?

Richard Lynch responded:
 Yes.

 Read the Cookie spec.

 There's no need for any site to ever send more than ONE Cookie anyway.

 Just use session_start() and you can store all the stuff in $_SESSION
 and it's all tied to the one Cookie.

 Users like me who set the browser to prompt for Cookies will often
 LEAVE a site that is being stupid and sending too many cookies, unless
 we really really really need your content, which is unlikely.

So you're calling my app stupid, Richard?? lol

To clarify, the app is for a small group of known users on an intranet, and
yes, they really really need the content. There are 24 check boxes, and
each selection triggers a graphical display of radiation levels in a
specific area over the last hour. Since the active areas - 12 to 15 usually
-  don't change all that much over time, I thought it would make sense to
have the app remember which boxes had been checked at last launch. I
didn't like the idea of using cookies, so I actually have a database
solution in place. But I've not dealt much with cookies, and I had some
time and tried to use them to solve the problem. That's when I ran into the
20 cookie limit with IE (Having just read the spec, I'm surprised that
Microsoft has actually followed it).

Unless there's something basic about $_SESSION variables I've missed, I
don't believe they would work here. I need to track and remember which
boxes are checked between sessions, not within a single session. Someone
please correct me if I'm mistaken.

Thanks again to Adam Zey for suggesting I serialize the cookie data. That
solved the problem.

David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Variables Maxing Out Using IE6

2006-08-17 Thread Adam Zey

[EMAIL PROTECTED] wrote:

There are 24 check boxes, and
each selection triggers a graphical display of radiation levels in a
specific area over the last hour.

David


So, if the user deletes the cookie, they grow a third eye? At last, a 
viable method of preventing privacy nazis from deleting my cookies!


Sorry, I couldn't resist ;)

Regards, Adam Zey.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie Variables Maxing Out Using IE6

2006-08-16 Thread dpgirago
Does IE6 limit somehow/somewhere the number of cookie variables I can
create and store?  The following code snippet successfully creates 24
cookie variables when run in FireFox, but in IE6 it is limited to 20.  I
can provide the full code with HTML/Javascript if anyone wants to test for
themselves.

David

?php

// populates a hidden form variable on the second submit
$somevar = anything;

if (!IsSet($_POST['monitors']) || empty($_POST['monitors'])) {
$_POST['monitors'] = array();
}

/*** Manage Monitor CheckBoxes via $_POST  $_Cookie */

// code in here only runs the first time the page is displayed
if ($_POST['trakVisit'] == ) {
  if (IsSet($_COOKIE['cookieMeter'])) {
foreach ($_COOKIE['cookieMeter'] as $key = $value) {
  if ($value == 'CHECKED') {
$checked[$key] = 'CHECKED';
  }
  else
$checked[$key] = ;
}
  }
}
// runs on the second and subsequent submits
elseif  ($_POST['trakVisit'] == anything) {
  for ($i=1; $i = 24; $i++) {
if (in_array($i, $_POST['monitors'])) {
  setcookie(cookieMeter[$i], 'CHECKED', time()
+60*60*24*12, '/', .mydomain.com, 1);
  $checked[$i] = 'CHECKED';
}
elseif(!in_array($i, $_POST['monitors'])) {
  $checked[$i] = '';
  setcookie(cookieMeter[$i], 'CHECKED', time()-3600, '/',
.mydomain.com, 1);
}
  }
}

echo pre;
print_r($_COOKIE);
echo /pre;

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Variables Maxing Out Using IE6

2006-08-16 Thread dpgirago

 On Wed, August 16, 2006 9:00 am, [EMAIL PROTECTED] wrote:
 Does IE6 limit somehow/somewhere the number of cookie variables I can
 create and store?

Richard Lynch wrote:
 Yes.

 Read the Cookie spec.

 There's no need for any site to ever send more than ONE Cookie anyway.

 Just use session_start() and you can store all the stuff in $_SESSION
 and it's all tied to the one Cookie.

 Users like me who set the browser to prompt for Cookies will often
 LEAVE a site that is being stupid and sending too many cookies, unless
 we really really really need your content, which is unlikely.

 You can Google and find the Cookie spec on Netscape's site -- It's
 very easy to digest, no pun intended, and a very well thought out
 spec.

Thanks, Richard. I'll take a look.

David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Variables Maxing Out Using IE6

2006-08-16 Thread Richard Lynch
On Wed, August 16, 2006 9:00 am, [EMAIL PROTECTED] wrote:
 Does IE6 limit somehow/somewhere the number of cookie variables I can
 create and store?

Yes.

Read the Cookie spec.

There's no need for any site to ever send more than ONE Cookie anyway.

Just use session_start() and you can store all the stuff in $_SESSION
and it's all tied to the one Cookie.

Users like me who set the browser to prompt for Cookies will often
LEAVE a site that is being stupid and sending too many cookies, unless
we really really really need your content, which is unlikely.

You can Google and find the Cookie spec on Netscape's site -- It's
very easy to digest, no pun intended, and a very well thought out
spec.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Question

2006-06-27 Thread Richard Lynch
Because their clock is set wrong on their computer...

Better to set a very long timeout and then handle the expiration
yourself.

Sorry.

On Fri, June 23, 2006 5:26 pm, Tom Ray [Lists] wrote:
 I've run into something rather odd with cookies today. I'm working
 with
 this admin section on a site and I'm setting a cookie that is supposed
 to be good for one hour. So in the cookie I have time()+3600 and all
 was
 well or that was until someone fired up IE. It seems that IE refused
 to
 set the cookie. After much swearing at IE, I found that if I set it to
 time()+7200 the cookie would be set.

 Not if that wasn't odd enough, in Firefox if I logged in at 6PM the
 cookie said it would expire at 8PM which is correct. However, when I
 logged in via IE at 6PM it said the cookie would expire at 23:00 hours
 (11PM for those who don't know)...so my question is...why is this
 happening and why does IE do this? I checked in Opera, Mozilla and
 Netscape and they all work the same as Firefox.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Question

2006-06-24 Thread tedd
At 6:26 PM -0400 6/23/06, Tom Ray [Lists] wrote:
I've run into something rather odd with cookies today. I'm working with this 
admin section on a site and I'm setting a cookie that is supposed to be good 
for one hour. So in the cookie I have time()+3600 and all was well or that was 
until someone fired up IE. It seems that IE refused to set the cookie. After 
much swearing at IE, I found that if I set it to time()+7200 the cookie would 
be set.

Not if that wasn't odd enough, in Firefox if I logged in at 6PM the cookie 
said it would expire at 8PM which is correct. However, when I logged in via IE 
at 6PM it said the cookie would expire at 23:00 hours (11PM for those who 
don't know)...so my question is...why is this happening and why does IE do 
this? I checked in Opera, Mozilla and Netscape and they all work the same as 
Firefox.

You answered the question yourself, you're testing IE. It sounds like M$ is 
trying to make time to adapt to their standard.

But, you're not alone -- try Google with IE cookies expiration

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Question

2006-06-24 Thread John Meyer

tedd wrote:

At 6:26 PM -0400 6/23/06, Tom Ray [Lists] wrote:

I've run into something rather odd with cookies today. I'm working with this 
admin section on a site and I'm setting a cookie that is supposed to be good 
for one hour. So in the cookie I have time()+3600 and all was well or that was 
until someone fired up IE. It seems that IE refused to set the cookie. After 
much swearing at IE, I found that if I set it to time()+7200 the cookie would 
be set.

Not if that wasn't odd enough, in Firefox if I logged in at 6PM the cookie said 
it would expire at 8PM which is correct. However, when I logged in via IE at 
6PM it said the cookie would expire at 23:00 hours (11PM for those who don't 
know)...so my question is...why is this happening and why does IE do this? I 
checked in Opera, Mozilla and Netscape and they all work the same as 
Firefox.


You answered the question yourself, you're testing IE. It sounds like M$ is 
trying to make time to adapt to their standard.

But, you're not alone -- try Google with IE cookies expiration

tedd
BTW, I have a question: which is the preferred way to handle variables 
on the client side: cookies or sessions? Or are there situations where 
one should be used and the other should be used in these other situations.


--
Online library -- http://pueblonative.110mb.com
126 books and counting.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Question

2006-06-24 Thread Robert Cummings
On Sat, 2006-06-24 at 10:51, John Meyer wrote:
 tedd wrote:
  At 6:26 PM -0400 6/23/06, Tom Ray [Lists] wrote:
  I've run into something rather odd with cookies today. I'm working with 
  this admin section on a site and I'm setting a cookie that is supposed to 
  be good for one hour. So in the cookie I have time()+3600 and all was well 
  or that was until someone fired up IE. It seems that IE refused to set the 
  cookie. After much swearing at IE, I found that if I set it to time()+7200 
  the cookie would be set.
 
  Not if that wasn't odd enough, in Firefox if I logged in at 6PM the cookie 
  said it would expire at 8PM which is correct. However, when I logged in 
  via IE at 6PM it said the cookie would expire at 23:00 hours (11PM for 
  those who don't know)...so my question is...why is this happening and why 
  does IE do this? I checked in Opera, Mozilla and Netscape and they all 
  work the same as Firefox.
  
  You answered the question yourself, you're testing IE. It sounds like M$ is 
  trying to make time to adapt to their standard.
  
  But, you're not alone -- try Google with IE cookies expiration
  
  tedd
 BTW, I have a question: which is the preferred way to handle variables 
 on the client side: cookies or sessions? Or are there situations where 
 one should be used and the other should be used in these other situations.

Ummm, how are you implementings sessions? Usually it's done by
cookies... or with trans_sid. Either way you shouldn't really be making
a distinction here. Unless of course you mean literally storing the data
in the client side cookie, versus storing a unique ID there that maps to
something in your database or filesystem... in which case go for the
latter, but make sure your ID is long enough and random enough to be
secure. Usiong PHP's built in session stuff usually works quite well and
saves you needing to do the low level work of linking up the cookie with
the data.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie Question

2006-06-24 Thread Larry Garfield
On Saturday 24 June 2006 09:51, John Meyer wrote:

 BTW, I have a question: which is the preferred way to handle variables
 on the client side: cookies or sessions? Or are there situations where
 one should be used and the other should be used in these other situations.

If it's a variable that you want the user to be able to hold onto for days, 
weeks, or months at a time (such as a remember me function for blog 
comments, for example), then use cookies, but NEVER store a username or 
password, even encrypted, in a cookie.

For everything else, use PHP's session handling, particularly the cookie-saved 
version.

Remember, cookies are user-supplied data.  That means it is not to be trusted.  
A session key is hard to hijack, or at least harder than it is to fake a 
non-random-key cookie.  It's easier to hijack if it's in the URL GET string 
rather than a cookie.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie Question

2006-06-23 Thread Tom Ray [Lists]
I've run into something rather odd with cookies today. I'm working with 
this admin section on a site and I'm setting a cookie that is supposed 
to be good for one hour. So in the cookie I have time()+3600 and all was 
well or that was until someone fired up IE. It seems that IE refused to 
set the cookie. After much swearing at IE, I found that if I set it to 
time()+7200 the cookie would be set.


Not if that wasn't odd enough, in Firefox if I logged in at 6PM the 
cookie said it would expire at 8PM which is correct. However, when I 
logged in via IE at 6PM it said the cookie would expire at 23:00 hours 
(11PM for those who don't know)...so my question is...why is this 
happening and why does IE do this? I checked in Opera, Mozilla and 
Netscape and they all work the same as Firefox.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie style saving without cookies

2006-05-09 Thread blackwater dev

I have a realty site where people want to be able to save properties but
don't want to enter a username/password, etc.  My first thought is just to
save the info to a cookie but am not sure if this is the best way.  If
cookies aren't allowed, they will loose this functionality.  I had thought
about grabbing their ip and just writing it to the db but the ip isn't
necessarily static.  Is there a better way to do this?

Thanks!


RE: [PHP] cookie style saving without cookies

2006-05-09 Thread Jay Blanchard
[snip]
I have a realty site where people want to be able to save properties but
don't want to enter a username/password, etc.  My first thought is just
to
save the info to a cookie but am not sure if this is the best way.  If
cookies aren't allowed, they will loose this functionality.  I had
thought
about grabbing their ip and just writing it to the db but the ip isn't
necessarily static.  Is there a better way to do this?
[/snip]

Ask them if they want to save their search data. If they click yes tell
them cookies must be enabled. 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie style saving without cookies

2006-05-09 Thread tedd

At 8:42 AM -0400 5/9/06, blackwater dev wrote:

I have a realty site where people want to be able to save properties but
don't want to enter a username/password, etc.  My first thought is just to
save the info to a cookie but am not sure if this is the best way.  If
cookies aren't allowed, they will loose this functionality.  I had thought
about grabbing their ip and just writing it to the db but the ip isn't
necessarily static.  Is there a better way to do this?

Thanks!


You don't have to ask them for anything nor permission to do 
anything. What you provide is public and what they provide via their 
visit is public. That's not to say that anything they enter should be 
made public, but it is to say that by a user visiting your site, does 
provide you with non-specific information that they share with every 
site they visit. So, in that manner the web works both ways in 
sharing information.


I use cookies all the time and if a use wants to have functionality 
with one of my sites, then cookies should be turned on, if not, then 
they deal with my sites not remembering them. I don't ever ask, or 
tell, the user to do anything -- I simply provide opportunity.


tedd

--

http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie reposted

2006-01-23 Thread tedd

Hi:

After I successfully writing a cookie, I'm having a problems reading 
the cookie repeatedly.


The first time into my read the cookie page, the cookie is read. 
However, the second time, it's not.


If I quit my browser and then reenter the read the cookie page, the 
cookie is there and read again. But leaving the page and returning 
produces no cookie. The cookie remains, but the page doesn't read it.


I have set up an example at:

http://xn--ovg.com

Do 1, Set Cookie -- it will create a cookie and report it. Then go to main
Do 2, Get Cookie -- it will report no cookie found.

[A] Quit your browser.

Return to:

http://xn--ovg.com/cookie/getcookie.php

It WILL report your cookie.

Leave the page and return back from anywhere, and your cookie will 
not be reported as there. However, if you go to [A] and repeat, 
you'll find your cookie remains.


Surely someone must know what's happening here.

Does anyone have any ideas?

It would be nice to have a persistent cookie. Do I also have to use a 
session to make this happen?


tedd
--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie reposted

2006-01-23 Thread David Grant
Tedd,

The cookie is being set on the www.xn--ovg.com domain.  The cookie is
being read on xn--ovg.com domain.  This is perceived to be a security
risk, so the cookie isn't sent.

David

tedd wrote:
 Hi:
 
 After I successfully writing a cookie, I'm having a problems reading the
 cookie repeatedly.
 
 The first time into my read the cookie page, the cookie is read.
 However, the second time, it's not.
 
 If I quit my browser and then reenter the read the cookie page, the
 cookie is there and read again. But leaving the page and returning
 produces no cookie. The cookie remains, but the page doesn't read it.
 
 I have set up an example at:
 
 http://xn--ovg.com
 
 Do 1, Set Cookie -- it will create a cookie and report it. Then go to
 main
 Do 2, Get Cookie -- it will report no cookie found.
 
 [A] Quit your browser.
 
 Return to:
 
 http://xn--ovg.com/cookie/getcookie.php
 
 It WILL report your cookie.
 
 Leave the page and return back from anywhere, and your cookie will not
 be reported as there. However, if you go to [A] and repeat, you'll find
 your cookie remains.
 
 Surely someone must know what's happening here.
 
 Does anyone have any ideas?
 
 It would be nice to have a persistent cookie. Do I also have to use a
 session to make this happen?
 
 tedd


-- 
David Grant
http://www.grant.org.uk/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie reposted

2006-01-23 Thread tedd

Tedd,

The cookie is being set on the www.xn--ovg.com domain.  The cookie is
being read on xn--ovg.com domain.  This is perceived to be a security
risk, so the cookie isn't sent.

David


???

Interesting -- the first time it's read correctly and the second time 
it's a security risk -- how doe that work?


tedd
--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie reposted

2006-01-23 Thread Richard Correia
By any chance, you are rewritting it/deleting it?

Thanks
Rich

On 1/24/06, tedd [EMAIL PROTECTED] wrote:

 Tedd,
 
 The cookie is being set on the www.xn--ovg.com domain.  The cookie is
 being read on xn--ovg.com domain.  This is perceived to be a security
 risk, so the cookie isn't sent.
 
 David

 ???

 Interesting -- the first time it's read correctly and the second time
 it's a security risk -- how doe that work?

 tedd
 --

 
 http://sperling.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Cookie reposted

2006-01-23 Thread Stut

tedd wrote:

Tedd,

The cookie is being set on the www.xn--ovg.com domain.  The cookie is
being read on xn--ovg.com domain.  This is perceived to be a security
risk, so the cookie isn't sent.

David


???

Interesting -- the first time it's read correctly and the second time 
it's a security risk -- how doe that work?


tedd


www.xn--ovg.com is not the same domain name as xn--ovg.com and the 
browser stores cookies against the domain so when the second request 
goes through on the second domain it does not get passed the cookie set 
on the first domain. If you want more Google for this topic - it's been 
covered to death in the past both here and pretty much everywhere else.


-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie reposted

2006-01-23 Thread tedd

By any chance, you are rewritting it/deleting it?

Thanks
Rich


Rich:

I'm definitely not rewriting the cookie, for if I quit the browser 
and return to the url again, the cookie data is still there. It's 
only when I return to the same url a second time that it doesn't 
appear again.


It looks like I'll provide this to you only once per starting your browser.

Maybe this is the way it works, but it's contrary to what I think 
should happen.


tedd




On 1/24/06, tedd [EMAIL PROTECTED] wrote:


 Tedd,
 
 The cookie is being set on the www.xn--ovg.com domain.  The cookie is
 being read on xn--ovg.com domain.  This is perceived to be a security
 risk, so the cookie isn't sent.
 
 David

 ???

 Interesting -- the first time it's read correctly and the second time
 it's a security risk -- how doe that work?

 tedd
 --



 http://sperling.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie reposted

2006-01-23 Thread Richard Correia
Can you check your temporary internet files for the cookie?

Does that cookie is deleted from the browser cache?

With OS/Webserver/browser you are using?

Thanks
Rich


On 1/24/06, tedd [EMAIL PROTECTED] wrote:

 By any chance, you are rewritting it/deleting it?
 
 Thanks
 Rich

 Rich:

 I'm definitely not rewriting the cookie, for if I quit the browser
 and return to the url again, the cookie data is still there. It's
 only when I return to the same url a second time that it doesn't
 appear again.

 It looks like I'll provide this to you only once per starting your
 browser.

 Maybe this is the way it works, but it's contrary to what I think
 should happen.

 tedd



 On 1/24/06, tedd [EMAIL PROTECTED] wrote:
 
   Tedd,
   
   The cookie is being set on the www.xn--ovg.com domain.  The cookie is
   being read on xn--ovg.com domain.  This is perceived to be a security
   risk, so the cookie isn't sent.
   
   David
 
   ???
 
 


Re: [PHP] Cookie reposted [Solved]

2006-01-23 Thread tedd

tedd wrote:

Tedd,

The cookie is being set on the www.xn--ovg.com domain.  The cookie is
being read on xn--ovg.com domain.  This is perceived to be a security
risk, so the cookie isn't sent.

David


???

Interesting -- the first time it's read correctly and the second 
time it's a security risk -- how doe that work?


tedd


www.xn--ovg.com is not the same domain name as xn--ovg.com and the 
browser stores cookies against the domain so when the second request 
goes through on the second domain it does not get passed the cookie 
set on the first domain. If you want more Google for this topic - 
it's been covered to death in the past both here and pretty much 
everywhere else.


-Stut


Ahhh, I see now. Regardless of if it's been beat to death, or not, my 
question wasn't IF there was a difference between a domain w/o www, 
but rather WHY my cookie wasn't working as I expected.


I wasn't aware of the sporadic www prefix addition to my url's at 
that site. I didn't notice that sometimes my url's would have the 
www prefix and other times they wouldn't. When they did have the 
www, the cookie would work and when they didn't, it wouldn't work. 
It was confusing, at least for me.


In any event, many thanks to all for pointing that difference out to 
me. I feel a lot better about cookies now.


Thanks.

tedd

--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie question

2006-01-22 Thread tedd

Hi:

Please review --

http://xn--ovg.com

 -- the Set and Get cookie demo (i.e., 1  2). The code is shown.

If you go from Set Cookie to Get Cookie, everything is OK.

If you cut the url, quit the browser, start the browser again, paste 
the url and return to the page, everything is OK. The browser finds 
the cookie.


However, if you go directly from:

http://xn--ovg.com

to Get Cookie, the cookie is gone -- why?  What's happening here?

Any ideas, suggestions, or solutions welcomed.

Thanks.

tedd
--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie problem

2006-01-15 Thread Curt Zirzow
On Sat, Jan 14, 2006 at 12:57:46PM -0500, Al wrote:
 Can't get a cookie to set. Below is the code near the file top BEFORE any 
 html output.
 ...
 ## code
 print_r($_POST)
 session_start();
 print_r($_COOKIE);

headers could be sent already, up your error_reporting, or check
your logs for headers already sent on line ...

 
 if(isset($_POST['prefs']))
   $cookie= setcookie(listpref, $_POST['filter'], time()+7776000);

what is the time() on the server vs the client?
is $_POST['filter'] set?

what is the actual header content set upon request?
livehttpheaders for Firefox is a good tool, if you dont have that
then the 'View Response Headers' via the Web Developer tool for
Firefox.

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie problem

2006-01-14 Thread Al

Can't get a cookie to set. Below is the code near the file top BEFORE any html 
output.

$_POST['prefs'] comes from a hidden field in the middle of the html output.

$_POST['filter'] comes from a select option.

A Submit button closes the page and refreshes it.

print_r($_POST) shows $_POST['prefs'] $_POST['prefs'] are just as I expect when 
the page refreshes.

## code
print_r($_POST)
session_start();
print_r($_COOKIE);

if(isset($_POST['prefs']))
$cookie= setcookie(listpref, $_POST['filter'], time()+7776000);

var_dump($cookie) shows bool TRUE

I added the session_start() as a test.

print_r($_COOKIE) shows the session ID cookie works just fine.

IE6 and Firefox don't record the regular cookie.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie problem

2006-01-14 Thread Aaron Koning
Try simplifying the problem to determine the error point. For example don't
involve $_POST just try setting a cookie with hard coded variables. If that
works then add in the $_POST and test for BOTH $_POST['prefs'] and
$_POST['filter'].

Example of simplification:

?php
// Send cookie
setcookie(listpref,selected,time()+7776000);
?

Aaron


On 1/14/06, Al [EMAIL PROTECTED] wrote:

 Can't get a cookie to set. Below is the code near the file top BEFORE any
 html output.

 $_POST['prefs'] comes from a hidden field in the middle of the html
 output.

 $_POST['filter'] comes from a select option.

 A Submit button closes the page and refreshes it.

 print_r($_POST) shows $_POST['prefs'] $_POST['prefs'] are just as I expect
 when the page refreshes.

 ## code
 print_r($_POST)
 session_start();
 print_r($_COOKIE);

 if(isset($_POST['prefs']))
 $cookie= setcookie(listpref, $_POST['filter'], time()+7776000);

 var_dump($cookie) shows bool TRUE

 I added the session_start() as a test.

 print_r($_COOKIE) shows the session ID cookie works just fine.

 IE6 and Firefox don't record the regular cookie.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Cookie problem with IE

2005-11-22 Thread Kristen G. Thorson

Jay Blanchard wrote:


But I sure would like to see the URL once he has clicked it. Have you tried
changing to $_GET['page']? Again, all of this is just for gigglesbut
there is likely to be a clue.

On privacy policies in IE (can he try another browser?) what is his setting?

 





I'm still waiting on definitive word as to what exactly his privacy 
settings are.  In my experiments, manually setting IE to Always Allow 
or Always Block cookies for a domain will completely override privacy 
settings.  I've had IE privacy set to allow no cookies, and manually 
added the domain to Always Allow and this overrode the no cookies setting.


For kicks and giggles, I changed $_REQUEST to $_GET, but he reported no 
difference.  Again, I don't see this as being the problem, since if it 
were so, he'd get no output at all instead of Cookie NOT set.  I'm 
quite convinced this is a matter of his cookie simply not being set.  He 
is not able to ever see a cookie for this domain in his temp internet 
files folder, though he tells us there are other cookies there.


I wish I could tell him to just use another friggin browser, but it 
would be nice to fix it so he can use the one he wants, no matter what 
words one can say about his choice. ;)


I have not looked into it, but do some internet security apps like 
Norton try to block certain cookies?  I've not come across this, as I 
don't really use those programs, but right now I'm grasping for straws.


thanks for the help so far,
kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Cookie problem with IE

2005-11-22 Thread Jay Blanchard
[snip]
I have not looked into it, but do some internet security apps like 
Norton try to block certain cookies?  I've not come across this, as I 
don't really use those programs, but right now I'm grasping for straws.
[/snip]

Certain anti-virus/spyware programs can and do block cookies and can be very
specific. Do you know if he is using something loike that? If so, can you
determine the settings?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Cookie problem with IE

2005-11-22 Thread Richard Davey
Hi Kristen,

Tuesday, November 22, 2005, 3:21:31 PM, you wrote:

 I have not looked into it, but do some internet security apps like
 Norton try to block certain cookies? I've not come across this, as I
 don't really use those programs, but right now I'm grasping for
 straws.

Yes they do - I replied to your original message to this mailing list
saying exactly that. I will copy it again:

What about third party software? Norton for example has cookie
features that will totally over-ride any IE setting with regards to
blocking them, etc. It's not the only one.

Ok, so not much detail - but you get the drift!

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Anyone have any suggestions?  I'm still stuck.


thanks,
kgt



Kristen G. Thorson wrote:

I'm having problems with a customer who can't login to a wholesaler 
application.  To ensure the problem was that the cookie was not being 
set, I sent him to this script:


if( !isset( $_REQUEST['page'] ) ) {
 setcookie('VATtest','Cookie has been set.',time()+5, /);
 echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
 if( isset( $_COOKIE['VATtest'] ) ) {
   echo $_COOKIE['VATtest'];
 } else {
   echo 'Cookie NOT set.';
 }
}
?


He got Cookie NOT set. which means exactly what it says.  He's using 
IE 6.0, and swears up and down that he's set it to always allow 
cookies from this domain.  I can't verify that he's set it correctly, 
but he has been told twice how to do it.  I also know his browser must 
be saving some cookies, as he is able to login to other sites.  Has 
anyone run into other sources of cookie-blockage in the past?  I 
cannot manage to duplicate this when I have IE set to always allow 
cookies from this domain.


Thanks for any tips,

kgt



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Anyone have any suggestions?  I'm still stuck.
[/snip]

Can you send him another test where a basic cookie gets set and then
checked?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Jay Blanchard wrote:


[snip]
Anyone have any suggestions?  I'm still stuck.
[/snip]

Can you send him another test where a basic cookie gets set and then
checked?

.

 




Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
}
?

Which is all I had in entirety.  Is this not a basic cookie?


thanks,

kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
 setcookie('VATtest','Cookie has been set.',time()+5, /);
 echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
 if( isset( $_COOKIE['VATtest'] ) ) {
   echo $_COOKIE['VATtest'];
 } else {
   echo 'Cookie NOT set.';
 }
}
?

Which is all I had in entirety.  Is this not a basic cookie?
[/snip]

Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly set
when (print_r the array...just for giggles)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie problem with IE

2005-11-21 Thread Kristen G. Thorson

Jay Blanchard wrote:


[snip]
Not sure what you mean.  I sent him to this script:

?php
if( !isset( $_REQUEST['page'] ) ) {
setcookie('VATtest','Cookie has been set.',time()+5, /);
echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
if( isset( $_COOKIE['VATtest'] ) ) {
  echo $_COOKIE['VATtest'];
} else {
  echo 'Cookie NOT set.';
}
}
?

Which is all I had in entirety.  Is this not a basic cookie?
[/snip]

Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly set
when (print_r the array...just for giggles)

.

 



I can verify $_REQUEST is correct for me, and I'm sure it's correct for 
him too, since he gets Cookie NOT set.  The second if statement 
requires $_REQUEST['page'] to be 1 to even get to that line.  If 
$_REQUEST['page'] is not set, he should get no output at all.


I've been looking through the comments in the manual, and several people 
mention privacy policies creating a problem in IE.  My problem is none 
of this can be duplicated on my machine (or any other so far), and this 
customer is in Florida and I'm in Virginia.  I've also never seen in 
other applications that a privacy policy truly needed to be sent to 
allow a cookie to be set, and apparently the web site manager settings 
(where you explicitly allow or block cookies from certain domains) 
override all privacy settings in IE anyways.  So that seems like a dead end.




thanks,

kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Cookie problem with IE

2005-11-21 Thread Jay Blanchard
[snip]
Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly
set
when (print_r the array...just for giggles)

I can verify $_REQUEST is correct for me, and I'm sure it's correct for 
him too, since he gets Cookie NOT set.  The second if statement 
requires $_REQUEST['page'] to be 1 to even get to that line.  If 
$_REQUEST['page'] is not set, he should get no output at all.
[/snip]

But I sure would like to see the URL once he has clicked it. Have you tried
changing to $_GET['page']? Again, all of this is just for gigglesbut
there is likely to be a clue.

On privacy policies in IE (can he try another browser?) what is his setting?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Cookie problem with IE

2005-11-21 Thread Richard Davey
Hi Kristen,

Monday, November 21, 2005, 4:48:26 PM, you wrote:

 I've been looking through the comments in the manual, and several
 people mention privacy policies creating a problem in IE. My problem
 is none of this can be duplicated on my machine (or any other so
 far), and this customer is in Florida and I'm in Virginia. I've also
 never seen in other applications that a privacy policy truly needed
 to be sent to allow a cookie to be set, and apparently the web site
 manager settings (where you explicitly allow or block cookies from
 certain domains) override all privacy settings in IE anyways. So
 that seems like a dead end.

What about third party software? Norton for example has cookie
features that will totally over-ride any IE setting with regards to
blocking them, etc. It's not the only one.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie problem

2005-11-18 Thread Kristen G. Thorson
I'm having problems with a customer who can't login to a wholesaler 
application.  To ensure the problem was that the cookie was not being 
set, I sent him to this script:


if( !isset( $_REQUEST['page'] ) ) {
 setcookie('VATtest','Cookie has been set.',time()+5, /);
 echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a';
} else if( $_REQUEST['page'] == '1' ) {
 if( isset( $_COOKIE['VATtest'] ) ) {
   echo $_COOKIE['VATtest'];
 } else {
   echo 'Cookie NOT set.';
 }
}
?


He got Cookie NOT set. which means exactly what it says.  He's using 
IE 6.0, and swears up and down that he's set it to always allow cookies 
from this domain.  I can't verify that he's set it correctly, but he has 
been told twice how to do it.  I also know his browser must be saving 
some cookies, as he is able to login to other sites.  Has anyone run 
into other sources of cookie-blockage in the past?  I cannot manage to 
duplicate this when I have IE set to always allow cookies from this domain.


Thanks for any tips,

kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookie-question?

2005-09-07 Thread Gustav Wiberg

Hi there!

Look at following code below, and please give me a clue why this 
cookie-thing doesn't work?

$IDJoke is set before and is an ID from a row in a db
It seems to work a while, but is there a limit for the expire-parameter?

/G
http://www.varupiraten.se/


//Get cookie from users computer for current joke to tell if user is 
allowed to vote or not!

   //
   $cookieJoke = $HTTP_COOKIE_VARS[$IDJoke];
   if ($cookieJoke == 'voted') {$showVoteValues ='N';$userVote = 'N';}

   //User wants to vote?
   //
   if ($voteNow == 'Y' AND $userVote == 'Y' AND $cookieJoke != 'voted') {

   $showVoteValues = 'N'; //Don't show values directly after 
vote...


   //Save IDJoke to a cookie with the value - voted to users 
computer
   setcookie($IDJoke, 'voted', time()+60*60*24*30*12*100);  /* 
expires in about 100 years*/


   //END User wants to vote
   //
   } 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie-question?

2005-09-07 Thread Jose Miguel
Ok, please correct me if i'm wrong...

First of all, i'd rather use $_COOKIE instead of $HTTP_COOKIE_VARS.

And in the line...

if ($voteNow == 'Y' AND $userVote == 'Y' AND $cookieJoke != 'voted') {

Why don't you use the operator NOT IDENTICAL (!==), cause != will also 
return true if the variables are the same type sometimes.

On 9/7/05, Gustav Wiberg [EMAIL PROTECTED] wrote:
 
 Hi there!
 
 Look at following code below, and please give me a clue why this
 cookie-thing doesn't work?
 $IDJoke is set before and is an ID from a row in a db
 It seems to work a while, but is there a limit for the expire-parameter?
 
 /G
 http://www.varupiraten.se/
 
 
 //Get cookie from users computer for current joke to tell if user is
 allowed to vote or not!
 //
 $cookieJoke = $HTTP_COOKIE_VARS[$IDJoke];
 if ($cookieJoke == 'voted') {$showVoteValues ='N';$userVote = 'N';}
 
 //User wants to vote?
 //
 if ($voteNow == 'Y' AND $userVote == 'Y' AND $cookieJoke != 'voted') {
 
 $showVoteValues = 'N'; //Don't show values directly after
 vote...
 
 //Save IDJoke to a cookie with the value - voted to users
 computer
 setcookie($IDJoke, 'voted', time()+60*60*24*30*12*100); /*
 expires in about 100 years*/
 
 //END User wants to vote
 //
 }
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Jose Arce
http://sinexion.com - http://josearce.com


Re: [PHP] Cookie-question?

2005-09-07 Thread Gustav Wiberg
 Original Message - 
  From: Jose Miguel 
  To: Gustav Wiberg 
  Cc: PHP General 
  Sent: Thursday, September 08, 2005 3:26 AM
  Subject: Re: [PHP] Cookie-question?


  Ok, please correct me if i'm wrong...

  First of all, i'd rather use $_COOKIE instead of $HTTP_COOKIE_VARS.

  And in the line...

  if ($voteNow == 'Y' AND $userVote == 'Y' AND $cookieJoke != 'voted') {

  Why don't you use the operator NOT IDENTICAL (!==), cause != will also return 
true if the variables are the same type sometimes.


  On 9/7/05, Gustav Wiberg [EMAIL PROTECTED] wrote:
Hi there! 

Look at following code below, and please give me a clue why this
cookie-thing doesn't work?
$IDJoke is set before and is an ID from a row in a db
It seems to work a while, but is there a limit for the expire-parameter? 

/G
http://www.varupiraten.se/


//Get cookie from users computer for current joke to tell if user is
allowed to vote or not!
//
$cookieJoke = $HTTP_COOKIE_VARS[$IDJoke]; 
if ($cookieJoke == 'voted') {$showVoteValues ='N';$userVote = 'N';}

//User wants to vote?
//
if ($voteNow == 'Y' AND $userVote == 'Y' AND $cookieJoke != 'voted') {

$showVoteValues = 'N'; //Don't show values directly after
vote...

//Save IDJoke to a cookie with the value - voted to users
computer
setcookie($IDJoke, 'voted', time()+60*60*24*30*12*100);  /*
expires in about 100 years*/

//END User wants to vote
//
}

--
PHP General Mailing List (http://www.php.net/ )
To unsubscribe, visit: http://www.php.net/unsub.php





  -- 
  Jose Arce
  http://sinexion.com - http://josearce.com 


--


  No virus found in this incoming message.
  Checked by AVG Anti-Virus.
  Version: 7.0.344 / Virus Database: 267.10.18/91 - Release Date: 2005-09-06

  Hi

  Ok, Thanx for the input! :-)

  /G
  http://www.varupiraten.se/


[PHP] cookie saving problem

2004-09-20 Thread Jason FB
PHP GENERAL LIST:
I am trying to get the session cookie to stay active for 10 years
I have at the top of EVERY page on my website an include statement 
which includes a file which contains only this code:

?
# THIS FILE JUST SETS THE SESSION AND INITIALIZES IT TO 10 YEARS
session_set_cookie_params(60*60*24*365*10);
session_start();
?
If I quit my browser and re-launch, it seems to remember my session 
variables. [Which was NOT the case when I had these two lines of code 
reversed -- the sesssion_start() before the 
session_set_cookie_params() ]

However, if I return to the site the following day, it seems to 
forget my session variables. This has happened 2 days in a row, so 
I'm a little stumped. Can anyone see what I'm doing wrong?

Also, is there something special that has to be done for Netscape  to 
make the cookie stay set for that long? (I saw some mention of a 
Netscape issue in the manual pages, which is what makes me ask).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] cookie saving problem

2004-09-20 Thread Marek Kilimajer
Jason FB wrote:
PHP GENERAL LIST:
I am trying to get the session cookie to stay active for 10 years
I have at the top of EVERY page on my website an include statement which 
includes a file which contains only this code:

?
# THIS FILE JUST SETS THE SESSION AND INITIALIZES IT TO 10 YEARS
session_set_cookie_params(60*60*24*365*10);
session_start();
?
If I quit my browser and re-launch, it seems to remember my session 
variables. [Which was NOT the case when I had these two lines of code 
reversed -- the sesssion_start() before the session_set_cookie_params() ]

However, if I return to the site the following day, it seems to forget 
my session variables. This has happened 2 days in a row, so I'm a little 
stumped. Can anyone see what I'm doing wrong?
Garbage colector deleted the session file. You need to change 
session.gc_maxlifetime setting and likely also session.save_path to your 
own diretory. Hope you have plenty of disk space available.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] cookie saving problem

2004-09-20 Thread Jason Wong
On Tuesday 21 September 2004 07:33, Jason FB wrote:

 I am trying to get the session cookie to stay active for 10 years

Session cookies as its name suggests lasts for the duration of the session, 
meaning your browser does not store them anywhere permanent and are lost when 
browser is closed.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A fool must now and then be right by chance.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookie behaviour

2004-08-23 Thread Chris Shiflett
--- Michael Purdy [EMAIL PROTECTED] wrote:
 script language=php
   setcookie('cat','large',time()+3600);
   setcookie('dog','small',time()+3600);
 /script
 
 The outcome of this script is that only the LAST cookie is successfully
 stored.

This seems unlikely. It's possible that neither of these statements is
successful (perhaps your script has output prior), and the only reason you
think the first one is being set is because it was set from a previous
test. You can rule this out by using unique names for every single test,
and use something like print_r($_COOKIES) to see exactly what cookies the
browser included in its request for the page.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-21 Thread Curt Zirzow
* Thus wrote water_foul:
 i figured it out ty

What did you figure out?  People searching the archives would like
to know :)

 ...
  On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
  [EMAIL PROTECTED] wrote:
  
   whats wrong with this script
   setcookie('link' . $loopnum . '',$url,time()+3600*200);
   setcookie('name' . $loopnum . '',$name,time()+3600*200);
   it doesn't write the cookies
  


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie question

2004-06-19 Thread water_foul
whats wrong with this script
setcookie('link' . $loopnum . '',$url,time()+3600*200);
setcookie('name' . $loopnum . '',$name,time()+3600*200);
it doesn't write the cookies

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread Joel Kitching
Did you do this before you sent some outut?  This would send headers,
therefore causing you to not be able to send the cookie header.

On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
[EMAIL PROTECTED] wrote:
 
 whats wrong with this script
 setcookie('link' . $loopnum . '',$url,time()+3600*200);
 setcookie('name' . $loopnum . '',$name,time()+3600*200);
 it doesn't write the cookies
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread water_foul
all i did was a function and some conditionals
Joel Kitching [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Did you do this before you sent some outut?  This would send headers,
 therefore causing you to not be able to send the cookie header.

 On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
 [EMAIL PROTECTED] wrote:
 
  whats wrong with this script
  setcookie('link' . $loopnum . '',$url,time()+3600*200);
  setcookie('name' . $loopnum . '',$name,time()+3600*200);
  it doesn't write the cookies
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread water_foul
lemme clarify what i mean by function, i created a function
Water_foul [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 all i did was a function and some conditionals
 Joel Kitching [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Did you do this before you sent some outut?  This would send headers,
  therefore causing you to not be able to send the cookie header.
 
  On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
  [EMAIL PROTECTED] wrote:
  
   whats wrong with this script
   setcookie('link' . $loopnum . '',$url,time()+3600*200);
   setcookie('name' . $loopnum . '',$name,time()+3600*200);
   it doesn't write the cookies
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread water_foul
sorry i misse dsomething else i should say, this is in the function but i
haven't sent any output before i call the function
Water_foul [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 lemme clarify what i mean by function, i created a function
 Water_foul [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  all i did was a function and some conditionals
  Joel Kitching [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Did you do this before you sent some outut?  This would send headers,
   therefore causing you to not be able to send the cookie header.
  
   On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
   [EMAIL PROTECTED] wrote:
   
whats wrong with this script
setcookie('link' . $loopnum . '',$url,time()+3600*200);
setcookie('name' . $loopnum . '',$name,time()+3600*200);
it doesn't write the cookies
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread Joel Kitching
Are you sure you're trying to access them properly, and on the next
page refresh?

ex)

?php
// Print an individual cookie
echo $_COOKIE[TestCookie];
echo $HTTP_COOKIE_VARS[TestCookie];

// Another way to debug/test is to view all cookies
print_r($_COOKIE);
? 

On Sat, 19 Jun 2004 15:56:36 -0600, water_foul
[EMAIL PROTECTED] wrote:
 
 all i did was a function and some conditionals
 Joel Kitching [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
  Did you do this before you sent some outut?  This would send headers,
  therefore causing you to not be able to send the cookie header.
 
  On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
  [EMAIL PROTECTED] wrote:
  
   whats wrong with this script
   setcookie('link' . $loopnum . '',$url,time()+3600*200);
   setcookie('name' . $loopnum . '',$name,time()+3600*200);
   it doesn't write the cookies
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread water_foul
i did that and it doesn't say that theere there, how do you set cookies so
that theyy dont expire (maby the expiration is set wrong.. i'm a newb
with cookies
Joel Kitching [EMAIL PROTECTED] wrote
Are you sure you're trying to access them properly, and on the next
 page refresh?

 ex)

 ?php
 // Print an individual cookie
 echo $_COOKIE[TestCookie];
 echo $HTTP_COOKIE_VARS[TestCookie];

 // Another way to debug/test is to view all cookies
 print_r($_COOKIE);
 ?

 On Sat, 19 Jun 2004 15:56:36 -0600, water_foul
 [EMAIL PROTECTED] wrote:
 
  all i did was a function and some conditionals
  Joel Kitching [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 
   Did you do this before you sent some outut?  This would send headers,
   therefore causing you to not be able to send the cookie header.
  
   On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
   [EMAIL PROTECTED] wrote:
   
whats wrong with this script
setcookie('link' . $loopnum . '',$url,time()+3600*200);
setcookie('name' . $loopnum . '',$name,time()+3600*200);
it doesn't write the cookies
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread Joel Kitching
There are many examples (in the comments) at the manual entry for
set_cookie at php.net; go try one of those.

On Sat, 19 Jun 2004 16:07:34 -0600, water_foul
[EMAIL PROTECTED] wrote:
 
 i did that and it doesn't say that theere there, how do you set cookies so
 that theyy dont expire (maby the expiration is set wrong.. i'm a newb
 with cookies
 
 Joel Kitching [EMAIL PROTECTED] wrote
 Are you sure you're trying to access them properly, and on the next
  page refresh?
 
  ex)
 
  ?php
  // Print an individual cookie
  echo $_COOKIE[TestCookie];
  echo $HTTP_COOKIE_VARS[TestCookie];
 
  // Another way to debug/test is to view all cookies
  print_r($_COOKIE);
  ?
 
  On Sat, 19 Jun 2004 15:56:36 -0600, water_foul
  [EMAIL PROTECTED] wrote:
  
   all i did was a function and some conditionals
   Joel Kitching [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
  
  
Did you do this before you sent some outut?  This would send headers,
therefore causing you to not be able to send the cookie header.
   
On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
[EMAIL PROTECTED] wrote:

 whats wrong with this script
 setcookie('link' . $loopnum . '',$url,time()+3600*200);
 setcookie('name' . $loopnum . '',$name,time()+3600*200);
 it doesn't write the cookies

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookie question

2004-06-19 Thread water_foul
i figured it out ty
Joel Kitching [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 There are many examples (in the comments) at the manual entry for
 set_cookie at php.net; go try one of those.

 On Sat, 19 Jun 2004 16:07:34 -0600, water_foul
 [EMAIL PROTECTED] wrote:
 
  i did that and it doesn't say that theere there, how do you set cookies
so
  that theyy dont expire (maby the expiration is set wrong.. i'm a
newb
  with cookies
 
  Joel Kitching [EMAIL PROTECTED] wrote
  Are you sure you're trying to access them properly, and on the next
   page refresh?
  
   ex)
  
   ?php
   // Print an individual cookie
   echo $_COOKIE[TestCookie];
   echo $HTTP_COOKIE_VARS[TestCookie];
  
   // Another way to debug/test is to view all cookies
   print_r($_COOKIE);
   ?
  
   On Sat, 19 Jun 2004 15:56:36 -0600, water_foul
   [EMAIL PROTECTED] wrote:
   
all i did was a function and some conditionals
Joel Kitching [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
   
   
 Did you do this before you sent some outut?  This would send
headers,
 therefore causing you to not be able to send the cookie header.

 On Sat, 19 Jun 2004 15:51:00 -0600, water_foul
 [EMAIL PROTECTED] wrote:
 
  whats wrong with this script
  setcookie('link' . $loopnum . '',$url,time()+3600*200);
  setcookie('name' . $loopnum . '',$name,time()+3600*200);
  it doesn't write the cookies
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie

2004-06-19 Thread water_foul
how do you set a cookie to mutiple directories?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cookie question...

2004-06-19 Thread water_foul
how do i read a cookie created by this code
setcookie('link1',blah,time()+3600,'/');

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   >