session_unset ($ _ SESSION)

1

Hello, does the session_unset($_SESSION); statement delete all existing sessions?

I have on the local server wampserver where the session variable is in my case in the following path: c:/wamp/tmp , when I create sessions on my pages the tmp folder receives for example a session $_SESSION['autentica'] = '1'; with the following name: sess_qvin6nvoq52caubdumc8duq684 with the following values: autentica | s: 1: "1"; .

When I use session_unset($_SESSION); the statement deletes everything in that folder (tmp).

a- Will this instruction override other users who would be logged in?

b- Is there a way to only exclude sess_qvin6nvoq52caubdumc8duq684 , without deleting the others?

From what I could see in this, I think I'm doing something wrong, because when creating the sessions, we always have something created in this tmp folder of the php server, but I realized that it ends up getting files that are not excluded.

I think I'm doing something wrong in handling the sessions, because this kind of "dirt" is always in the tmp folder of the server.

Can this be avoided?

    
asked by anonymous 12.01.2018 / 17:46

1 answer

1

In order for you to keep the tmp folder without dirt, the best option is to use session_destroy because it destroys all stored data during the session as can be seen here !

session_unset that you are currently using only clears the global $ _ SESSION variable as seen here .

    
12.01.2018 / 18:04