User Auth. and Sessions in PHP

  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post November 17th, 2003, 5:42 pm

Alrighty,

I understand the legistics behind user's logging in, it's simply. My first question is then, what exactly is user authentication, is it simply checking a user name against a password which may or may not be encrypted, or is it something more?

Next I read up on sessions in the PHP documentation, and I think I understand how they basically work. This may go along with authentication, or it may not because I am not too sure what it is, but am I correct in assuming that when someone log's in, they can get a session ID, which I can place in a database, along with a column that says they are logged in, then if I run a query on that database, and gather the row with the users ID, and compare the session ID to the IP if they are logged in, and it checks to make sure that that user is logged in from that computer? Now as I type this it isn't quite making sense, because an IP can be the same from multiple computers over a LAN, so would that mean that it uses a cookie to say they are logged in, and the session ID is then only used to store certain variables?

And finally, *most* user oriented websites log someone out after they close the window, how is this done? Assuming that I was right with the cookies above, it eats it, but then I have a value in my database saying the user is logged in, so what do I do?

Thanks for help on any or all of the above topics, would greatly appreciate it as I hope to experiment with user support for my signature (oh yes getting tricky now, won't tell you what I am going to change, I'll leave ya hangin)!

Thanks again,
Pixel Acres V2
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 17th, 2003, 5:42 pm

  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Joined: Jun 15, 2003
  • Posts: 4583
  • Loc: Maryland
  • Status: Offline

Post November 18th, 2003, 4:54 pm

After much google searching, and finally finding the right keywords, I came out with this site:

http://www.scriptsharks.com/articles/sessions.php

which is exactly...almost exactly what I was looking for. I should be able to adapt it for my own use and hopefully have a new cool addition to my signature script.
Pixel Acres V2
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post November 18th, 2003, 5:42 pm

I remember posting this once before, but if you didn't see it or remember it, this may give you some added info about sessions you may find beneficial re: invalid sessions. Particularly in regards to phpBB, but it can be applied elsewhere:

http://www.phpbb.com/kb/article.php?article_id=54


---------------------------------
Actually now that I think about it, I didn't post that here before. I sent it to a couple others when I was researching how to maintain security at my own place. And after looking at your post in a bit more detail (trying to understand this whole thing myself) it appears you probably have seen it.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 170 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.