5, July 2009

Cookie problems with v0.93 - possibly bugs? Includes suggestions... - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  Php User Class
Topic: Cookie problems with v0.93 - possibly bugs? Includes suggestions...
« previous next »
Pages: [1] Print

Author Topic: Cookie problems with v0.93 - possibly bugs? Includes suggestions...  (Read 582 times)
I crack Photoshop!
*
Gender: Male
Posts: 3
22 credits
Members referred : 0


« on: Jun 06, 2008, 07:08:34 am »

I was troubleshooting some things today, getting this class to work. I've come across a couple of peculiarities in the process. This is all done using Safari 3.1.1 on OSX.5.3, PHP 5.2.5, Apache 2.2.8.

1 - I was unable to set a cookie in the login() function while testing on localhost. Setting the cookie domain to any value at all caused the browser to reject it & not set the cookie.
Removing the final parameter from the setcookie() call fixed it.

Original code #1: (inside login() function)
Code:
<?php
$a 
setcookie($this->remCookieName$cookie,time()+$this->remTime'/'$this->remCookieDomain);
?>

My working code #1:
Code:
<?php
$a 
setcookie($this->remCookieName$cookie,time()+$this->remTime'/');
?>



2 - The logout() function was not removing my cookie. The setcookie() call in this function was re-setting the cookie, but omitted the path parameter. This had the effect of setting a new cookie with the same name, but the path parameter defaulted to a different value (in my case, /phpUserClass).
Adding '/' as the fourth parameter to the setcookie() call in the logout() function fixed this.

Original code #2: (inside logout() function)
Code:
<?php
setcookie
($this->remCookieName''time()-3600);
?>

My working code #2:
Code:
<?php
setcookie
($this->remCookieName''time()-3600'/');
?>


I hope this is helpful. Now that I have the basic login/logout working, I can't wait to get this integrated into a couple of new CMS projects I'm building. Are there any issues I'm missing that might arise from leaving off the domain parameter while setting the cookie? It seems to be common to have problems setting cookies on localhost with Apache. I couldn't come up with any value that would work.

Thanks for all your hard work and for releasing this sweet class!

Cheers,
Kris
« Last Edit: Jun 06, 2008, 06:19:42 pm by kris_mcl »
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7769
Tags : v0.93 cookie login logout Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  Php User Class
Topic: Cookie problems with v0.93 - possibly bugs? Includes suggestions...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 05, 2009, 01:06:14 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 40.885
Total Topics: 8.088
Total Members: 5.826
Tutorials : 58
Resources : 929
Designs : 312
Latest Member: htmlcut

28 Guests, 4 Users online :

8 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2009 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.