|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-01-03 17:20 UTC] ricardomestre at oninetspeed dot pt
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... :/
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
I just noticed that the included page doesnt read normal vars or even session vars. for instance: Page test.php <?php $sib = 'yes'; if($sib == 'yes') { for($i = 1; $i <= 3; $i++) { include 'http://www.pmexpresso.com/database/code.php?page=1'; } } ?> Page code.php <?php if($sib == 'yes') { print "You can see the code<br>"; } else { print "You must login first<br>"; } ?> the result is: You must login first You must login first You must login first