Login Options

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Login Options

Post by reverend_ink »

I have a script and want to keep people from being able to view it unless they login. And then when logged in they get to look at all the pages until they leave, then if returning they have to loggin once again.

I am considering sessions but havent used them often.

Any recommendations?

Thanks
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

session is exactly what you need

http://www.php.net/manual/en/ref.session.php
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Post by reverend_ink »

That what I thought, but I havent dealt with them often, I generally deal with CMS systems and they are protected via htaccess
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

man everyone loves sessions, I dont really fancy em, they're nice, but ah well..

i'm an old school cookie man =]

setcookie () with combo of isset() will create a handy dandy way of keeping users logged-in and they're info (username n password, etc) for a easy fetch.

even better - a combo of them both
Chambrln
Forum Commoner
Posts: 43
Joined: Tue Dec 02, 2003 10:45 am
Location: Oregon

Post by Chambrln »

Sessions can do pretty much exactly the same stuff cookies can, except sessions terminate once the browser is closed or you specifically terminate it in your code.

Cookies are good if you want to keep someone logged in to your site once they leave but if you are trying to just do a one time visit authentication then I would say use sessions.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

check out phpsecurepages.com
Post Reply