Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
This is quite easy - you'll be interested in two cookies: w3t_myid and w3t_key.

myid contains the user number. key contains an md5 hash of the user number + the password as stored in the database (i.e. md5("$user_number$password"))

Some Perl, as my PHP is a little rusty...

Code
use CGI::Cookie; <br />use Digest::MD5 qw(md5_hex); <br />my %jar = fetch CGI::Cookie; <br />my $this_user_number = $jar{"w3t_myid"} ? $jar{"w3t_myid"}->value() : 0; <br />if($this_user_number) { <br />        my $passwd = $dbh->selectrow_arrayref("select U_Password from w3t_Users where U_Number = ?", undef, $this_user_number); <br />	my $key = md5_hex("$this_user_number$passwd->[0]"); <br />	if($key ne $jar{"w3t_key"}->value()) { <br />		# User is logged in, but password doesn't match <br />	} else { <br />		# User is logged in, and password matches <br />	} # end if <br /> <br />} else { <br />        # User is not logged in <br />} # end if <br />


If all your code is in PHP, you might want to look at including the Threads libraries directly, then using the internal calls to authenticate the user... though this may be difficult if your application is on the complex side. Things might conflict a bit.

Anyway. Once you've authenticated the user, then you can just pull the rest of the user info out of the database based on his number.


UBB.classic: Love it or hate it, it was mine.
Sponsored Links
Entire Thread
Subject Posted By Posted
Working with threads cookies? Trav 03/10/2004 7:27 PM
Re: Working with threads cookies? Charles Capps 03/10/2004 9:26 PM
Re: Working with threads cookies? Trav 03/12/2004 5:46 AM
Re: Working with threads cookies? Astaran 03/12/2004 1:46 PM
Re: Working with threads cookies? scroungr 03/12/2004 3:38 PM
Re: Working with threads cookies? Charles Capps 03/12/2004 8:10 PM
Re: Working with threads cookies? scroungr 03/12/2004 9:16 PM

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
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 254
Joined: January 2000
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,824
Most Online6,139
Sep 21st, 2024
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,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
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-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)