GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Php / SSI include HELP! Any gurus around? (https://gfy.com/showthread.php?t=302455)

whee 05-27-2004 03:21 AM

Php / SSI include HELP! Any gurus around?
 
This I can't figure and would appreciate any help or clue to the solution.

I have a .shtml file in the root with:
#include file="dir/file.php"

In file.php I set a J-avascript cookie:
document.cookie='cookname=value;';

Later in another php file, I write the cookie value:
echo $cookname;

This works real fine, no problems there.
Here's the problem:

In a directory mydir, I also have a .shtml file with
#include virtual="/dir/file.php" (same file as above)

The file loads and all, but somehow the J-avascript cookie in file.php is not set!

I figure it's something with the virtual include. But virtual include is a must because the file to include is called from a directory and not the root. Therefore a #include file="yadayada" cannot be used.

I can't figure why the J-avascript cookie isn't set and written...

Any help or clue to "kick-start-my-mind" sure will be appreciated!!

:helpme

bawdy 05-27-2004 03:27 AM

setcookie('cookie', 'data', time() + 3600, '/');

make sure you got that slash there... then it will work on your entire domain

JDog 05-27-2004 03:28 AM

Quote:

Originally posted by whee
This I can't figure and would appreciate any help or clue to the solution.

I have a .shtml file in the root with:
#include file="dir/file.php"

In file.php I set a J-avascript cookie:
document.cookie='cookname=value;';

Later in another php file, I write the cookie value:
echo $cookname;

This works real fine, no problems there.
Here's the problem:

In a directory mydir, I also have a .shtml file with
#include virtual="/dir/file.php" (same file as above)

The file loads and all, but somehow the J-avascript cookie in file.php is not set!

I figure it's something with the virtual include. But virtual include is a must because the file to include is called from a directory and not the root. Therefore a #include file="yadayada" cannot be used.

I can't figure why the J-avascript cookie isn't set and written...

Any help or clue to "kick-start-my-mind" sure will be appreciated!!

:helpme

if globals are off, you can't do $cookiename you'd have to do $_COOKIES['cookiename']

jDoG

whee 05-27-2004 03:51 AM

Whee!

The solution was to put path=/ into the J-avascript cookie setting...

Thank you guys for giving me the final clue! Appreciate.

:) :) :glugglug :thumbsup


All times are GMT -7. The time now is 07:27 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123