sharpdust Posted February 10, 2006 Share Posted February 10, 2006 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.[code]function session_checker(){if(!session_is_registered('first_name')){include 'login_form.html';exit();} [/code]Is this really secure? Wouldn't it better to check if the user has the right username or better, the right userid #? Quote Link to comment https://forums.phpfreaks.com/topic/3380-best-for-validation/ Share on other sites More sharing options...
azuka Posted February 10, 2006 Share Posted February 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/3380-best-for-validation/#findComment-11549 Share on other sites More sharing options...
fenway Posted February 10, 2006 Share Posted February 10, 2006 Alternatively, use the user/pass/whatever to create a unique sessionID, and store that, and then just check that on every page. Quote Link to comment https://forums.phpfreaks.com/topic/3380-best-for-validation/#findComment-11552 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.