R
R
Ruslan Kerimov2020-02-18 23:18:12
PHP
Ruslan Kerimov, 2020-02-18 23:18:12

It is necessary to exit the profile with the session, how can I do this?

Guys please help me! I need on my website so that I can exit the profile only by clicking on the exit button. And at the moment I have, for example, I went to my profile, but when I click on the back arrow in
the browser navigation, I already exit .But I would like to do, for example, if I am in my profile, then I will have an exit button on all pages of the site and not an entrance. Well, the authorization page should not be available to authorized users and just when I have already entered the profile by clicking the arrow in the navigation back I will have those pages that are available to authorized users here is the site

In principle, you need to exit the profile like here

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
NedoKoder, 2020-02-18
@NedoKoder

on all pages, check for the presence of session_start (), and when saving authorization parameters in the session, set the cookie storage time to a couple of years

A
AUser0, 2020-02-19
@AUser0

Typically, going "back" in the browser causes the browser to show the previous page from the browser's cache. As a result, the page is not re-requested from the server. And therefore it remains the same, without user authorization. Then you press "forward" in the browser, and again the data from the browser cache, and oops, the user is authorized.
But there are nuances... (c) an anecdote.

X
xmoonlight, 2020-02-19
@xmoonlight

Learn Sessions in PHP at php.net

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question