From: ricardomestre at oninetspeed dot pt
Operating system: NT
PHP version: Irrelevant
PHP Bug Type: Unknown/Other Function
Bug description: Included page doesn't read cookies
Description:
------------
Hello all,
Im sorry if this thread is repeated or even if its not a bug, but i
searched a lot and no one could help me...
Here's the situation, i am trying to do a print page, and instead of
printing a page one by one, i thought it would be best to have all the
pages in one.
My code its pretty complex and specific so i made two simple pages with
similar sctructure to see what happens.
Reproduce code:
---------------
Page test.php
<?php
setcookie("loged","yes",time()+3600, '', '.domain.com'); ###this setcookie
its just to save time when testing, but it doesnt affect the final
result...
if($_COOKIE['loged'] == 'yes') {
for($i = 1; $i <= 3; $i++) {
include 'http://www.domain.com/database/code.php?page=1';
}
}
?>
Page code.php
<?php
if($_COOKIE['loged'] == 'yes') {
print "You can see the code<br>";
} else {
print "You must login first<br>";
}
?>
Expected result:
----------------
I'd expect to see:
You can see the code
You can see the code
You can see the code
Because the cookie is set...
Actual result:
--------------
Page test.php
The cookie is set,
it checks it just to prove that its well set,
to include the page 3 times the 'for',
the include with full link because of the args.
Page code.php
Cookie test fails... $_COOKIE['loged'] returns nothing.
and so the final result is:
You must login first
You must login first
You must login first
final note: Accessing code.php directly works fine. With include
doesn't... :/
--
Edit bug report at http://bugs.php.net/?id=31390&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31390&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31390&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31390&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31390&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31390&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31390&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31390&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31390&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31390&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31390&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31390&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31390&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31390&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31390&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31390&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31390&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31390&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31390&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31390&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31390&r=mysqlcfg