Php skinning w/ cookies question.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Forget it. Look on php.net and read about isset()... it doesn't do what you want :evil:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

lose the hostility and watch the swearing theda.

isset() doesn't check the value of any variable, it only checks if the variable exists.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Okay, then why dont you explain how I can use a PAGE.PHP?VAR=SOMETHING, mmk? I don't know how many times I have to say it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_GET['url_varname'] :roll:
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

For some reason, I can't even get the setcookie to actually SET a cookie...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make sure to pass a path argument that is at or a child of the folder in which you want to use it. make sure the domain argument is properly set. If you switch between http and https during some of this, you may require alternate means of transfer.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

All my stuff is http/unsecure and I have it like this:
setcookie("language", $ver, time()+604800);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mmkay, so you read the last sentance.. now, what about the first two?
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Everything is under one directory... except the images, but that has nothing to do with this. And the other part I don't know.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Okay, do you have the page that attempts to set the cookie up somewhere? And the same for the page trying to access it?

Note: it typically requires a page refresh for the cookie to become "visible" to the script.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

I was using another page to set the cookie. This is how my weblayout is set up:

Index.php loads "ver.php" which checks what version to use (de or en). Then everything is set to $ver so that if ver = en, then everything "en" will show up ($ver."/file.ext").

I have the cookie set up on "set.php" which only yas "<? cookieblah ?>" on it. ver.php is suppost to load weither $ver = en or de.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

my question still stands, are these files online somewhere?
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

8O PHP 4.0.6, that's a really old version.

It appears your host attempts to add a popup to all pages. :roll:

All the page outputs is warnings...


set.php attempts to output a cookie:

Code: Select all

Set-Cookie: language=deleted; expires=Fri, 20-Feb-04 20:10:57 GMT
that'd normally set a cookie called 'language' with value 'deleted' with a path of '/', domain of 'dumbass.ionichost.com', and unsecure flag. $HTTP_COOKIE_VARS['language'] should contain the value 'deleted' on the next page request after hitting the page including set.php. However, the timestamp appears way off. So at this time, it'd likely delete the cookie, however you are setting a value to it.. which may make it persist, depending on the browser.
Last edited by feyd on Sat Feb 19, 2005 2:17 pm, edited 1 time in total.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

So what do I do? I know I can add <noscript> at the end of the php and that usually stops the popups
Post Reply