ID: 25929 Updated by: [EMAIL PROTECTED] Reported By: joe at kybert dot com -Status: Closed +Status: Bogus Bug Type: Variables related Operating System: XP (debug server) PHP Version: 4.3.2
Previous Comments: ------------------------------------------------------------------------ [2003-10-21 16:44:25] joe at kybert dot com ok, thanks... So im now assuming there is no way to include a file that can have _GETs sent to it, and see cookies. <? wish list ?> joe # ------------------------------------------------------------------------ [2003-10-21 16:38:35] [EMAIL PROTECTED] I assumed from your first post that when you were including the file through http, you weren't parsing on the remote server. (I've seen similar set ups before. Not recommended, though, or necessary in virtually all cases.) You can't see the cookie in $_COOKIE from the second file because it's not being requested from the machine you see the cookie on, but rather the script that does the include. If you requested the file as source rather than parsed so that it would be parsed via the first file, it would probably work. Your second example of passing arguments to the second file won't work either because you can't pass arguments to a script that way. Just make some variables before including the file, the second file will see them. J ------------------------------------------------------------------------ [2003-10-21 16:05:13] joe at kybert dot com Why not? The remote file is on the same server, and the cookie was set to be accessable to all files from that domain. If you dont include it this way, you cannot pass arguments to the included file, this doesnt work: include("{$_SERVER['DOCUMENT_ROOT']}/test/file2.php?myparam=hello"); joe # ------------------------------------------------------------------------ [2003-10-21 15:17:06] [EMAIL PROTECTED] If you include REMOTE file, of course the cookie is not passed to it. ------------------------------------------------------------------------ [2003-10-20 19:59:26] joe at kybert dot com Description: ------------ Cookie is not readable across multiple files. I have 2 files, file 1 sets a cookie (refresh file after 1st exe so cookie is sent) it then includes file 2, which reads and displays the cookie. Both files are in the same folder on the server, which is <servername>/test/<filenames> . File 2 fails to read the cookie! Reproduce code: --------------- file1.php contains: <?php setcookie("test", "set_by_file_1", time()+3600, "/", $_SERVER['HTTP_HOST']); echo "file 1 cookies: "; print_r($_COOKIE); include("http://$SERVER_NAME/test/file2.php"); ?> file2.php contains: <?php echo "<br>file 2 cookies: "; print_r($_COOKIE); ?> Expected result: ---------------- file 1 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 ) file 2 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 ) Actual result: -------------- file 1 cookies: Array ( [LastUser] => ujoe [test] => set_by_file_1 ) file 2 cookies: Array ( ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25929&edit=1