Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2002
Posts: 5
Lurker
Lurker
Offline
Joined: Jun 2002
Posts: 5
I believe the persistent login problem has to do with domain.com versus www.domain.com. I wrote a game that required user authentication. I was getting the same problem because I sort of learned how to do it by examining your code. It had to do with how you set the cookie.

The code I ended up using that worked without a hitch was the following:

code:

// after successfull login username/password match
function set_cookies($name,$pass)
{
global $myname,$mypass;

$Password_e = crypt_password($pass);
setcookie("myname","$name",time()+31536000,"/",".mydomain.com");
setcookie("mypass","$pass",time()+31536000,"/",".mydomain.com");
}

// logout code
function clear_cookies()
{
global $myname,$mypass;

setcookie("myname","",time()-3600,"/",".mydomain.com");
setcookie("mypass","",time()-3600,"/",".mydomain.com");
}



Now when you set cookies you don't specify the domain name. So it gets confused if people switch between www.domain.com and just domain.com. For example, your code:

code:

setcookie("w3t_myid","$Uid",time()+$config'cookieexp'],"{$config['cookiepath']}");



A lot of people describe this same problem:

-They login.
-It looks like they logged in successfully
-When they click on the index it tells them they haven't actually logged in properly. Invalid username/password.

When people described the problem along those lines I would tell them to do the following which seemed to fix it:

- Go to http://www.domain.com/board/logout.php
- Try logging in again.

Then they would tell me that it worked.

Sponsored Links
Entire Thread
Subject Posted By Posted
Problems with cookies Gilliad 06/19/2002 8:26 PM
Re: Problems with cookies Rick 06/19/2002 8:55 PM
Re: Problems with cookies Gardener 06/19/2002 9:06 PM
Re: Problems with cookies Gilliad 06/19/2002 9:13 PM
Re: Problems with cookies Dave_L_dup1 06/19/2002 9:46 PM
Re: Problems with cookies JoshPet 06/20/2002 4:51 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,574
Posts293,926
Members13,850
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)