yusof_hardy Posted November 20, 2006 Share Posted November 20, 2006 ok I have [code]session_start(); [/code] at the top of every page of the site... The session lifetime is set to 1 hour On successful log-in, I assign [code]$_SESSION['userid']=$ID; [/code] So it means if $_SESSION['userid'] is set, then the user has logged in.. The problem is, after I log-in, I can still open another brower windows and log-in as another user. Apparently, Seperate Session variables are created by different browser windows. I can log-in as different users by opening new windows on the same computer... It's complicated Help!! Link to comment https://forums.phpfreaks.com/topic/27865-session-problem-im-getting-different-session-on-different-browser-windows/ Share on other sites More sharing options...
kenrbnsn Posted November 20, 2006 Share Posted November 20, 2006 Sessions are tied to browser windows. That's how they work. If you want to restrict the number of users using your script to one per machine, you will have to look into other methods of validation and tracking like using cookies.Ken Link to comment https://forums.phpfreaks.com/topic/27865-session-problem-im-getting-different-session-on-different-browser-windows/#findComment-127479 Share on other sites More sharing options...
yusof_hardy Posted November 23, 2006 Author Share Posted November 23, 2006 Thanks!! :)So how does a typical log-in system should implement?Combination of session and cookie?Pls help me.. Link to comment https://forums.phpfreaks.com/topic/27865-session-problem-im-getting-different-session-on-different-browser-windows/#findComment-129075 Share on other sites More sharing options...
Petsmacker Posted November 23, 2006 Share Posted November 23, 2006 I only use cookies for my log-in and log-out systems. They're far more reliable and convenient.Look into the setcookie() function and change the $_SESSION variables on your page to $_COOKIESessions are unreliable for log in stuff. You should also have a 'password' cookie as well with an encrypted password. Otherwise people could simply use software to edit the 'userid' cookie to whatever they want and then be logged in as anybody else. Link to comment https://forums.phpfreaks.com/topic/27865-session-problem-im-getting-different-session-on-different-browser-windows/#findComment-129131 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.