Re: problem with include()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2004-11-01 at 16:08, Richard Davey wrote:
> Hello Jason,
> 
> Monday, November 1, 2004, 10:34:16 PM, you wrote:
> 
> JD> the login page is included ... the login page does not see the auth
> JD> cookie until the user refreshes their browser ... why is this happening?
> 
> Cookies (set via setcookie) are not available to you on the same page
> as you set them. The function is a means to send a special header to
> the browser that makes it create the cookie when the page loads which,
> at this point in your script, hasn't happened yet.
> 
> If you are including the login.php script further down the page then
> rather than checking for the cookie itself, why not just check for the
> original value you set the cookie to?
> 
> Best regards,
> 
> Richard Davey


thanks a lot Richard :)

I was just about to email this simple test case ... so even tho you
told me the answer I,ll post so someone else might use it

i am misunderstanding cookies and/or include() ... please look at this
code...

sc.php
<?php
setCookie('data' , 'blah');
include 'gc.php';
?>

gc.php
<?php
print $_COOKIE['data'] . " <-here";
?>


this is the out put of running sc.php

<-here


why is this , i want to set a cookie ... then have a include do
something
with it ... is this not possible to do during the same http transaction?

thanks




> -- 
>  http://www.launchcode.co.uk - PHP Development Services
>  "I am not young enough to know everything." - Oscar Wilde

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux