Jump to content


Photo

Best For Validation


  • Please log in to reply
2 replies to this topic

#1 sharpdust

sharpdust
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 February 2006 - 06:04 PM

In the tutorial "Creating a Membership System". To check if a user is logged in or not they check to see if the session first_name variable matches.

function session_checker(){
if(!session_is_registered('first_name')){
include 'login_form.html';
exit();
}

Is this really secure? Wouldn't it better to check if the user has the right username or better, the right userid #?

#2 azuka

azuka
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts
  • LocationNigeria

Posted 10 February 2006 - 06:16 PM

Of course that's infinitely more secure. I suggest you hash both the user id and the password in the session using md5 (for the password I think yyou should md5() it twice). Then for each page you compare the user name and the password with the ones in the session before you do anything.
Given enough eyeballs all bugs are shallow. My Website

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 February 2006 - 07:47 PM

Alternatively, use the user/pass/whatever to create a unique sessionID, and store that, and then just check that on every page.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users