Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-14-2008, 12:19 AM update setcookie
Skilled Talker

Posts: 69
Trades: 0
I am trying to override a setcookie to a new value. I have the following but it is not working:

$retunpage='test';
if (isset($_COOKIE['example']))
{setcookie( "example" , $retunpage );
setcookie( "auth" , "ok" ); }
setcookie( "example" , $retunpage );
setcookie( "auth" , "ok" );

Any suggestion on how I can simultaneously delete a cookie and set it again?
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-14-2008, 06:08 AM Re: update setcookie
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
You should not delete the cookie to set the new value, you should simply set the new cookie with the same name and new value.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-14-2008, 11:02 AM Re: update setcookie
Skilled Talker

Posts: 69
Trades: 0
I have on the top of many pages:

setcookie( "example" , $returntopage);
setcookie( "auth" , "ok" );

However, when going to multiple pages like web page a, b and c with the setcookie (as you stated), the cookie is not overridden with the new value on each page.

For example, I have web page a, b and c. After completing forms, you can always return to the page (a, b, c) that started in all. I tried using javascript history but it doesn't accout for people who don't complete the form w/o errors.
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
Old 07-15-2008, 01:48 AM Re: update setcookie
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Quote:
Originally Posted by weddingm View Post
However, when going to multiple pages like web page a, b and c with the setcookie (as you stated), the cookie is not overridden with the new value on each page.
How do you check that the cookie is not overwritten?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-15-2008, 06:34 PM Re: update setcookie
Skilled Talker

Posts: 69
Trades: 0
I check it by going to page "a" and the page creates cookie "a" as their web page. Then, I go to page "b", complete a form from page "b". Then, once the form is completed...I am routed back to page "a" instead of page "b".
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
Old 07-16-2008, 10:27 AM Re: update setcookie
Skilled Talker

Posts: 69
Trades: 0
Thanks all for the help. I changed all pages to

setcookie( "cookie" , $value, time()+3600, '/');
setcookie( "auth" , "ok" );

and all works great.
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to update setcookie
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23510 seconds with 12 queries