answersLogoWhite

0


Best Answer

Depends what you mean with that. If the user logs out, the session gets destroyed, and with it the session ID. You'd need to grab the session ID before the user logs out.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you get the session after the user logs out in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a php session?

A PHP session is a concept where specific variables (and their respective values) are carried throughout a user's viewing of a PHP-driven website. These sessions can be initialized and continued using the session_start() function. The session values are stored in the $_SESSION global variable. For more information, see the php.net documentation of session functions.


How do you reset session variables?

<?php // start session session_start(); // Assign value to session $user = $_SESSION['variable_name']; // variable_name = value to store in session // To reset session variable use below method unset($user); // If you want to destroy all session variables use below method session_destroy(); // destroys all session variables ?>


WHAT is the difference between session and cookie in php?

The session is stored on the web server. The cookies is stored in a little file on users machine. This means that the session is (relatively) secure, whereas the cookie can be edited by the end user.


Why do you use sessions in PHP?

There are a lot of reasons to use session. Mostly to keep sensitive data housed on the server (and not on user's computer in cookies). It is also a much easier and more dynamic way to store data than Cookies, and far more reliable than constant GET or POST passing. As http is a stateless transaction, there's no way to tell what the user i.e. in a shop wants to buy, or has already stored. In come PHP sessions, which are carrying an ID and are stored similar to cookies in your browser. Usually a session is lost as soon as the browser closes or the user logs off. It furthermore helps to keep information private between the user and the server machine.


What nis meant by session in php?

A session is a file on the server (sometimes is a database entry) that allows the web application to track the user. Whenever you "login" to something, that's a session. Sessions are most often used to determine a users level of access and privileges.


Write down a PHP code to add a session variable?

The preferred way is to simply alter the session superglobal. <?php $_SESSION['variable'] = "value"; ?>


What is the purpose of a PHP session?

A PHP session serves quite a few purposes. PHP sessions store data that the web application developer would like to have preserved across the different page loads.


What is the HTML for not letting someone access the same page twice in the same session?

HTML does not provide session handling. If you are using PHP for sessions though, you could simply check whether a session exists before the page is built up and return an error if there is already one. Of course you will have to watch out with that, because it's possible that the session hasn't been closed when the user left the page, i.e. it might happen that a user is opening the page for the first time but already has an existing session anyway.


How do you maintain a session in a PHP quiz script?

All you have to do to maintain a session is start it before you call any variables. Once you've started the session, you can store variables for use in later scripts. Beware though, once the user closes the browser, the sessions' over. I'd use the following SCRIPT 1: <?php // Start session session_start(); // Set some variables (this simulates form input) $_SESSION['answers']['Q1'] = 18; $_SESSION['answers']['Q2'] = 36; $_SESSION['answers']['Q4'] = "Fred"; ?> ============================= Hope that helps...


How do you keep form values in php while edting?

The easiest way to do this is with the $_SESSION variable, which allows you to store values on the server that are unique to a user's session. e.g. $_SESSION['foo'] = 'bar'; Alternately, you could retain them in cookies in the user's browser, or as parameters in the URL.


Which type of user profile does not save user settings when the user logs off?

Mandatory.


When a user logs on what is created that identifies the user and all of the user's group memberships?

access token