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
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

as I said earlier:
the first page should set the cookie.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

What codes should I have on set.php (to make sure I have things right)

and what should I have on ver.php so that it loads the cookie (to make sure everything i'm doing is right).

I must be a pain in the bum for you ^_^
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you try the url's once you removed your explicit $ver = whatever ?
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

I just switched it to

"$ver = $HTTP_COOKIE_VARS["language"];"
and all I get is "cannot get .blah" It's missing the "en" or "de" before the period.

I did blah.com/set.php?set=en and it didn't do anything.

set.php still has:

Code: Select all

<?


setcookie("language", $ver, time()+604800);


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

Post by feyd »

notice the difference in the urls you used and mine.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You're a patient guy feyd. Hey theda... hope you got it working in the end! :lol:
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Holy burgermeister! Good job! lol. Im dumb sometimes. Now to add a few last things so that when it sets the cookie on set.php that it refreshes to index.php instead of just sitting there. Thanks for now. If I end up screwing somethign up, I'll harass you more about it ^_^
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Just add

Code: Select all

header('location: index.php');
Right after your last line of code in set.php ;-)
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Thanks. All works fine. One of my friends tried to view my website (1/5 people who did this) and said there was an error. I put a "setcookie" in index.php (and renamed the original index.php to main.php) and had to set one, then redirect to the main page... But for some reason he kept getting an error (pretty much nothing wanted to load the $ver var...). It was solved easily by having him go to set.php?ver=en and have him set a cookie that way. I dont know how many other people will have this problem, but it is working dandy. Thanks.
Post Reply