There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem router slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
PHP, user authentication


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Mikrondel's Avatar
Member with 49 posts.
 
Join Date: Jun 2005
Location: Australia
Experience: Budding Genius
27-Oct-2005, 05:11 AM #1
PHP, user authentication
I'm working on something where a user types a name and password and then proceeds into a system of pages where he/she can do stuff.

What I need is simply for all the pages involved to be able to check if a user has logged in correctly. I've got a few ideas but I'd like any further comments or suggestions.

Points to consider:
-A timeout is not important but I'll use it if it's not much work to implement.
-Security is not very important, this is mainly for a local area thing.
-Passwords will be in a database, I can handle this on my own. It's just the passing information from one page to another that I'm not sure about the best way.
-I'm fine with a "log out" when the window is closed.


I can obviously record the Username and Password and POST them onto the next page each time you change pages. That would require checking the password each time a new page loads. Not a big deal, though. And the username and password would also show up in the HTML source. But this is currently my preferred option.

I've looked a bit at PHP's session stuff; it seems a bit more trouble than it's worth for something this simple.

Are there any other hidden tools PHP has that I could use here? I'm using Apache in case there's something in that.

I'm basically after a simple solution to implement that doesn't need to be too robust.

Thanks in advance
Mithrilhall's Avatar
Senior Member with 781 posts.
 
Join Date: Mar 2001
Location: AU Microscopii
Experience: Studying for my CCNA
27-Oct-2005, 10:16 AM #2
cookies?
Gibble's Avatar
Distinguished Member with 27,137 posts.
 
Join Date: Oct 2001
Location: Striking or Scoring
Experience: The Alpha and Omega
27-Oct-2005, 12:44 PM #3
NEVER pass the USERNAME and PASSWORD along all the pages...you may as well not put a password on it, if you're going to do that.

Throw a sessionId in a database table of "currentlogins" and set a cookie to that value.

Then on each page you want secured, you include a file which checks for a cookie with a sessionId, looks in the table of current logins, if it's there...you're gold, if not, no good and they have to re-enter their username and password...done.
__________________
izme: You know...it's kind of nice to sit atop Civilized debate and look down below on all of the uncivilized master debating we are here...just out of the fight zone

Gibble: Now you know what it's like to be Canadian.
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
27-Oct-2005, 09:13 PM #4
You can use Apache's htaccess for authentication.
Otherwise, sessions and cookies is most likely what you're looking for.
Mikrondel's Avatar
Member with 49 posts.
 
Join Date: Jun 2005
Location: Australia
Experience: Budding Genius
28-Oct-2005, 04:57 AM #5
I already said, I don't mind insecurity. But this cookie and session ID thing doesn't look too complicated anyway.

About cookies... I'm a lazy guy and you're kind and helpful people :P
Basically I'm not in the mood for reading through docs right now, and I haven't used cookies before;
What I need to know is what cookies store (is it just a text string?), how I create them with PHP, and how I read them from PHP. Also how are they named or told apart, and is it possible to throw out the cookies when someone logs out?

If someone could point me to a public-domain example of a simple authentication system along these lines (I wouldn't expect you to make up an example on the spot! Unless you're really nice ) that would probably be all I need.

Anyway, thanks.

-Mikrondel
Gazornenplat's Avatar
Senior Member with 106 posts.
 
Join Date: Dec 2004
Location: Xabia, Spain
Experience: 20 years of programming
28-Oct-2005, 07:26 AM #6
Just set and check AUTH_USER and AUTH_PWD on the pages you need to protect
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
28-Oct-2005, 05:03 PM #7
There are about a thousand free login scripts, try Google.
Mikrondel's Avatar
Member with 49 posts.
 
Join Date: Jun 2005
Location: Australia
Experience: Budding Genius
28-Oct-2005, 06:27 PM #8
Damn, I guess I have to do some work, lol.

I don't want to use Simple Authentication because different users will get access to different things. Unless Apache can read from two specific columns in a database...
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:22 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.