php - Is it good to wipe $_SESSION before using it? -
I'm still new to Example: I am telling you people's opinions. In my strange logic, maybe I could write from Therefore, any Extra: What should I do here? no In fact, very bad and your example code will make your sessions unusable. When you call About logging in and out: Your logout process Any session data that is destroyed by the user recognizes (perhaps their ID) is usually done by using I can not imagine any other way to log out a user, if you have provided more information, then I can give you a better answer about it. It appears about your excess that your authentication system can use some work when you are already logged in, then you should not be able to reach a login page. (Even as an administrator, because it is the second user with more privileges, right?). If you have manually typed in the login url, you will have to redirect the homepage to it. Good writing on this topic, I should do some research! Thanks @ Hamza And here is my super basic phony code authentication process: sessions wipe out
$ _ session Is before using it?
$ _ session = array (); $ _SESSION ['id'] = 1; $ _SESSION ['name'] = 'any';
Because I do not have many experiences in the session .
logout to
administrator session and
login > Member Session
$ _ session / > value from admin will still be in the
$ _ session array
1. I Admin user and
logout from
admin page was not
2. Now I go from admin page to
member login page
kick admin
admin page because he is not a member?
session_start () you are given a blank
$ _ session / > or you
$ _ Sessions can retrieve data saved on For more information about sessions, check the PHP docs:
unset , i.e.
unset ($ _ session ['user_id']) Is .
Does the current page need authentication Yes: What user Login? Yes: Are the users the right private sector to see? Yes: credentials! Show page number: Print a message that says something like, "You are in the wrong place" No: No redirects to login: Page
Comments
Post a Comment