[PHP] Re: Cookie problem

2006-01-16 Thread Al

Al 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.


Problem solved.  Was a slap-on-the-forehead, dummy, type.

Note, the test print_r() BEFORE the setcookie().  It is obviously sent before 
the html header.

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



[PHP] Re: Cookie problem with IE

2005-11-22 Thread n.g.
save below as testcookie.php, request it from your browser twice, what
do you get at 2nd time?
  ?php
   setcookie('sessioncookie', 1);
   setcookie('storedcookie',1,time()+3600);

   var_dump($_COOKIE);
  ?

On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 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




--
Tomorrow will be a good day :-)

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



Re: [PHP] Re: Cookie problem with IE

2005-11-22 Thread Kristen G. Thorson

n.g. wrote:


save below as testcookie.php, request it from your browser twice, what
do you get at 2nd time?
 ?php
  setcookie('sessioncookie', 1);
  setcookie('storedcookie',1,time()+3600);

  var_dump($_COOKIE);
 ?

On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 


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

 

 



Request from MY browser?  I get

array(2) { [sessioncookie]= string(1) 1 [storedcookie]= 
string(1) 1 }


This isn't a problem in my browser, however.  I don't want to keep 
sending this customer to random scripts, so can you explain the point of 
this script?  I mean, in what way might this help me figure out why his 
browser is not setting a cookie?



thanks,

kgt

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



[PHP] Re: Cookie problem with IE

2005-11-22 Thread n.g.
did i say it? sorry, i mean load the page in your customer browser.

the code you give simple test stored cookie, which might be blocked by
browser. however browser blocks stored cookie might allow session
cookie, they are not stored so are less insecurity.

bad thing is your customer have some antivirus/firewall software
installed you even cant rely on http referer header, as well as
cookies.

and you have to do something before you can find out what is
happening, isn't it ?

On 11/22/05, n.g. [EMAIL PROTECTED] wrote:
 save below as testcookie.php, request it from your browser twice, what
 do you get at 2nd time?
   ?php
setcookie('sessioncookie', 1);
setcookie('storedcookie',1,time()+3600);

var_dump($_COOKIE);
   ?

 On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
  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
 
 


 --
 Tomorrow will be a good day :-)



--
Tomorrow will be a good day :-)

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



[PHP] Re: cookie problem..

2003-02-23 Thread Joel Colombo

make sure u run a  session_start(); before anything on the page
u cant access any session vars without it.

Joel




Terry Lau [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,
  I want to set a cookie when I enter a text into the text field, and
it
 shows the text I submitted immediately, thus I write a sample php code
like
 this:

 ?php
 if (isset($HTTP_POST_VARS['Name'])) {
 setcookie(name, $HTTP_POST_VARS['Name'], time()+86400*10);
 }
 echo $name;
 ?
 (I set the text field is Name and the data will be sent to another page)

 In another page, I insert ?php echo $HTTP_COOKIE_VARS['name']; ? in the
 beginning of the code.

 Is the code right?

 Then I run the test, I enter a name into the text field and submit it. But
 it shows Notice: Undefined index: name in .., it can't show the name I
 submitted.
 Why?Anything wrong??

 Thanks!!
  Terry




 _
 ¤µ¤é¬P®y  http://www.msn.com.hk/fortune/west/ ¹Bµ{




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



[PHP] Re: cookie problem..

2003-02-22 Thread Lord Loh.
Cookies are loaded the next time the page is loaded. So you may have to
refresh the page to see the cookie...

or

Submit to a html page which will redirect to the page which shows cookie
value...

Hope this helps...This should work...

Lord Loh



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



[PHP] Re: cookie problem. Not possible to set and read a cookie on the same page?

2002-03-26 Thread Julio Nobrega Trabalhando

  Not possible, read the manual page about setcookie:

www.php.net/setcookie

  There's a 'common pitfall' entry saying so.

  Don't know why. Maybe the cookie is only written to user's disk after the
page is fully loaded, maybe for security reasons.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I am wondering if it is possible to send a cookie and read it on the same
 page.

 Following environment:

 There is a cookie already on the machine of the client, but expired.
 Now I am setting a new cookie and reading it on the same page via $sess_id
=
 $HTTP_COOKIE_VARS[$sesscookiename];

 Unfortuanaelly it gives me the old session id back. After refreshing I am
 getting the new sessid and everything works fine. The cookie has been sent
 with the right value, I did dubble check it. But the HTTP_C... reads the
old
 one.

 why? Thanx for any help,

 Andy







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




[PHP] Re: cookie problem

2002-02-11 Thread Hasan Niyaz

Hi all,

Perhaps some one can help me.

If I send a cookie like 
setcookie(+ACI-cookie+AF8-agtpasswd+ACI-,+ACQ-form+AF8-agent+AF8-pass, time()+-1200, 
+ACI-/+ACI-)+ADs-

it does not work on the terminal which has a new version of windows 2000 and with IE6. 
The browser does not store the cookie.

but if I use 
setcookie(+ACI-cookie+AF8-agtpasswd+ACI-,+ACQ-form+AF8-agent+AF8-pass)+ADs-

I can retrive the cookie variable.

This happens on a few terminal but for others with win 2000, both cookie sends above 
works fine.

Has anyone come across this problem?
Has anyone got any suggestions. Is this a problem of the win 2000 or the browser 
setting.

thanks,
Hasan







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