TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-03-2012, 03:22 AM   #1 (permalink)
The Visitor
 
Kingdom's Avatar
 
Join Date: Jan 2011
Posts: 3
Thanks: 1
Kingdom is on a distinguished road
Help Problem updating Cookie on live host

This works fine on localhost, but the same code just won't update my live website cookie. Here's the code:

index.php
PHP Code:
    $lg->updateCookies($username$hashSalt[0]); 
updateCookies function:
PHP Code:
    $site '.ciadacapa.com.br'

    
// ---------------------------------------------------
    // Updates the cookies
    // ---------------------------------------------------
    
function updateCookies($username$hash){
        
setcookie('ciadacapaUser'''time()-3600'/'$this->site);
        
setcookie('ciadacapaHash'''time()-3600'/'$this->site);
        
setcookie('ciadacapaUser'$usernametime()+3600*24*7'/'$this->site);
        
setcookie('ciadacapaHash'$hashtime()+3600*24*7'/'$this->site);
        
        return 
true;
    } 
Although the class is receiving the correct values, the cookie just retains the old value it had and never updates. Any ideas on this?

Thanks in advance!
Kingdom is offline  
Reply With Quote
Old 01-05-2012, 10:11 PM   #2 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

This script works for me

PHP Code:
setcookie('TESTCOOKIE'''time()-3600);
setcookie('TESTCOOKIE''value' rand(1,20), time()+3600); 
So I would assume yours would work as well. I tested that using Firefox 9.

When you set a cookie it sends the following in the headers

Code:
Set-Cookie: TESTCOOKIE=deleted; expires=Wed, 05-Jan-2011 22:09:38 GMT
TESTCOOKIE=value11; expires=Thu, 05-Jan-2012 23:09:39 GMT
So I wonder if the browser is getting confused with setting the same cookie twice. I don't know though. This is all speculation.
__________________
Eric
wGEric is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Live Chat API for PHP developers Released by Banckle banckle Libraries & Extensions 0 05-10-2011 12:32 AM
Huge Session Problem Killswitch General 1 11-17-2008 02:36 AM
Saving ALL the cookie data using cURL Wildhoney Advanced PHP Programming 1 06-12-2008 07:07 PM
host & uri problem - not displaying? Sam Granger Absolute Beginners 2 10-12-2007 01:51 PM
Taking a Bite out of the Set Cookie Function Wildhoney General 2 09-29-2007 07:52 AM


All times are GMT. The time now is 10:53 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design