PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 9th, 2002, 06:23 AM
verylost verylost is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: southern california
Posts: 12 verylost User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to verylost
major cookie problem

ok, hers the problem:
i have a page that allows the user to log in, and sets this cookie:

setcookie('admin',$username,$userexp)

$userexp being the users set time for the cookie to expire.

i have a small thing on the top of the page like this :
if(isset($_COOKIE['admin'])) $logged = 1;
else $logged = 0;

on the same page as where the user logged in, it is correct, and $logged is set to '1', but on a seperate page, it always sets to '0'!

how would i get the cookie to work on any page on my site, not just the one page i set the cookie on? thanks ahead of time

Reply With Quote
  #2  
Old August 9th, 2002, 07:07 AM
zhabala zhabala is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 zhabala User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: major cookie problem

Hi the setcookie function has an additional parameters path and domain, which can be used to set a level on which is cookie set. I tryied to use

setcookie('admin',$username,$userexp,'/') and now is cookie visible on other pages too.

Read the manual
boolean setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])

Zdenek

Reply With Quote
  #3  
Old August 9th, 2002, 07:12 AM
verylost verylost is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: southern california
Posts: 12 verylost User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to verylost
RE: major cookie problem

thanks, i had so much trouble with this! i read and re-read the manual, and couldnt figure out how to get it to work. ill get back to you on the progress of it.

Reply With Quote
  #4  
Old August 9th, 2002, 07:40 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to siteworkspro.com Send a message via AIM to siteworkspro.com
RE: major cookie problem

It happens to the best of us

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > major cookie problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway