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-13-2005, 02:09 PM User Auth
Average Talker

Posts: 23
Trades: 0
What is the best way to handle user login with mysql and sessions?
tobeyt23 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-13-2005, 02:20 PM
Enigmatic's Avatar
Registered User

Posts: 86
Location: No Fixed Abode
Trades: 0
if your server is PHP then yes, sessions are a good way of creating client areas.
Enigmatic is offline
Reply With Quote
View Public Profile
 
Old 07-14-2005, 09:53 AM
Average Talker

Posts: 23
Trades: 0
Yes it is php ... any examples or tutorials?
tobeyt23 is offline
Reply With Quote
View Public Profile
 
Old 07-14-2005, 11:41 AM
pushedtomb's Avatar
Super Talker

Posts: 100
Name: Nathen
Location: Casnewydd, De Cymru, UK
Trades: 0
Managing Users With PHP Sessions and MySQL
__________________

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


Quote:
- "I've often wondered how MS can say that other software "isn't compatible" with MS when MS stuff isn't even compatible with other MS stuff" - quote from Daily Thing.com
pushedtomb is offline
Reply With Quote
View Public Profile
 
Old 07-14-2005, 12:44 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
sitepoint is awesome. altho i didn't really agree with that article
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 07-15-2005, 09:11 AM
Average Talker

Posts: 23
Trades: 0
do you have anything that I can reference?

Last edited by tobeyt23; 07-15-2005 at 09:44 AM..
tobeyt23 is offline
Reply With Quote
View Public Profile
 
Old 07-15-2005, 06:10 PM
Experienced Talker

Posts: 47
Trades: 0
Basically all you need to do is register variables as session when they login

So lets say, if you had the information in a database you'd query the database to get the username/passwords, then match it against what they put in. If it is correct then just do something like this
PHP Code:
$_SESSION['USERNAME'] = $sqlrow['USERNAME'];
$_SESSION['PASSWORD'] = $sqlrow['PASSWORD'];
$_SESSION['USERID'] = $sqlrow['USERID']; 
And include any other variables that you want to check through every page.
Then in each page that requires login just have this
PHP Code:
if (!session_is_registered("USERID"))
{
    
session_destroy();
    
header("Location: login.php");

And when you want to check the variables you can just use
PHP Code:
$_SESSION['VAR'

Also, to logout just use session_destroy(); and it dumps all session variables.

Hope this is of any help.
Synchronize is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to User Auth
 

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.72296 seconds with 12 queries