How to destory session in PHP

How to destory session in PHP

Hi,

I have to write a php page for logout. Please tell me what i should write?

Thanks

View Answers

December 3, 2010 at 11:08 AM

Hi,

You can use following code for logout:

<?
session_start();
session_destroy();
header("location: index.php");
?>

Thanks









Related Tutorials/Questions & Answers:
How to destory session in PHP
How to destory session in PHP  Hi, I have to write a php page for logout. Please tell me what i should write? ThanksADS_TO_REPLACE_1   Hi, You can use following code for logout: <? session_start(); session
Session in Php
Session in Php   What Is a Session
Advertisements
php session
php session  what is session
Session management in php - PHP
Session management in php  I am creating a simple program in PHP to manage the session of user. It's basically a simple form that will allow a user to fill & submit the offer form after login. Please Explain me how can i create
php session timeout
php session timeout  How to check if the session is out or timeout have occurred in the PHP application
php maintain session id
php maintain session id   How to maintain session ID for a user in PHP
What is the default session time in php and how can I change it?
What is the default session time in php and how can I change it?  What is the default session time in php and how can I change
Maximum length of Session ( $_SESSION ) in PHP.
Maximum length of Session ( $_SESSION ) in PHP.  sir, i want to know that how much limit of storing data into session in php. i mean can i store full product descriptions into session. Thank u
session update in php
session update in php  How to session update in php?   $this->session->set_userdata('name', $fullname
php session for login and logout
php session for login and logout  Session management code to create a login and logout session in PHP. Thanks
session cookies expire - PHP
session cookies expire  when do a session cookies expire in PHP
Create Session Variable PHP
Create Session Variable PHP  hi, Write a program which shows the example of how to create session variable in PHP. Please suggest the reference... session Variable in PHP. May be this reference will solve your query. Thanks
session management for login logout in php
session management for login logout in php  how to manage session for login and logout in php
iPhone php session
iPhone php session  Hi, I am developing an application for iPhone. In my application user validated with a php file on server. Now I don't know how... code for session management in iPhone application backed with PHP server code
PHP Session
Session: A session variable is used to store some useful data and that data is accessible from every page. In PHP $_SESSION is a pre-defined variable... of coding (before html). Example:ADS_TO_REPLACE_2 <?php session_start
php session - Security
php session  My php session value is doesn't get. I checked the php code is correct. when this runs under php4 version. But didn't run under php5... Friend, Please visit the following link: http://roseindia.net/php/php
setting php session variable by ajax
setting php session variable by ajax  Hello folks, i developing a php website where the content of the section load dynamically from database... tried to use AJAX to call another PHP script to set the session variable
PHP Session
PHP Session        A PHP session variable is used to store the information about a user... (To close the session): <?php SESSION_start();ADS_TO_REPLACE_6 if(isset
in php What the code is to be written for Authentication with Session Control
in php What the code is to be written for Authentication with Session Control  in php What the code is to be written for Authentication with Session Control
Fatal error: Call to undefined function session_register() in .php file
Fatal error: Call to undefined function session_register() in .php file  I upgraded the PHP and MySQL and in my application following error is coming: Fatal error: Call to undefined function session_register() in ...php file
session
Session Management in PHP  Handling session in PHP. Can anyone please explain it with the help of an existing example about, how to handle a session while a user is logged in PHP
Decoding the session
to set decoding session. <?php session_start(); $session=$_SESSION["...Decoding the Session session_decode() is used for decoding session. It decodes the session from a string. It returns True on success or False on failure
Starting the session.
. SyntaxADS_TO_REPLACE_1 session_start(); Example: <?php session_start(); echo...session_start() session_start function creates a session or resumes the current one based on the  current session id that is being passed via a request
session
session  create multiple login on one page in php but how to use session
How To Turn On the Session Support?
How To Turn On the Session Support?  How To Turn On the Session Support
Session Modification
Session Modification in PHP Session modification can be done through incrementing the loop. As the counting of loop increments, the session be modified. ... of the session register. ADS_TO_REPLACE_1 Run the counter.  <?php
Create session variable.
Create session variable In this example, you will learn how to create session... command of PHP. Email has been set to find the session value, if the program finds the correct email address, the value of the session is set.  <?php
session_save_path()
session_save_path() session_save_path() command returns the current working directory path.  SyntaxADS_TO_REPLACE_1 session_save_path(); Example: <?php echo session_save_path(); #return the current working directory path
how to create session for login
how to create session for login  how to create session for login? how to display uploaded resume and images in the profile
PHP list all session variables
of the php file variable names and values gets stored in the session. Example of PHP List All Session Variables session1.php <?php   ...;  session_register($subject); ?> session2.php <?php   
Custom Session Handler
Custom Session Handlers session_set_save_handler() function is used... storage.  In the following program you will learn how to customize your session handler. We have used opening the session, reading it, writing
Session Register
Session Register For session register, you will have to first create an action form in HTML that calls the php session_register code.   In PHP form... code, we have used server[PHP_SELF] call. ADS_TO_REPLACE_1 <?php session
Session regenerated id
.  Now use the session_regenrateid and set this id to new sessionid. <?php...Session regenerated ID session_regenerate_id() works to regenerate the session by replacing oldsessionid.  For this, first start the session, ADS
Destroying the session
) Parameters data Example: <?php session_start(); $_SESSION = array...Destroying Session Session_destroy() function is used for destroying all of the data associated with the current session. Neither it does not intervene any
session_unset()
session_unset() session_unset function is used for removing all variables in a session. For unsetting the session, it must be opened. Let's see in the example. <?php session_start(); $_SESSION["email"] = "
Session_cache_limter()
;?php session_cache_limiter('roseindia'); $cachelimiter = session_cache_limiter(); session_cache_expire(180); $cacheexpire = session_cache_expire...Session_cache_limter() session_cache_limiter() returns the name of the current
Session Date Encode
Session Date Encode In this example, you will learn how to encode date session. First create a HTML form and call the PHP form action in it. In PHP code, use... For this first register the session and define the session variable.  <?php
Session
Session  What Is a Session?   Hi friends, A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP
how to put php in javascript
how to put php in javascript  How to write a javascript code inside php block
How to learn PHP
How to learn PHP  Hi, PHP seem easy language and beginners can find jobs in PHP easily. How to learn PHP? Thanks   Hi, You can learn PHP easily and we have 1000s of tutorials to teach you PHP. Check: PHP Tutorials
Session
Session   hii, What Is a Session?   hello,ADS_TO_REPLACE_1 Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor
Session
Session   how to session maintaining in servlet with use of hidden fieds
how to use calender in php
how to use calender in php  how to put calender in php
how to update image in php
how to update image in php  how to update image in php
How to use session in struts 1.3
How to use session in struts 1.3  i want to know how to use session in Struts specially in logIn authentication
Session
Session  How fined session is new or old
How to learn PHP?
How to learn PHP?  Hi, How I can learn PHP easily? ThanksADS...://www.roseindia.net/php/ADS_TO_REPLACE_2 Thanks  Hi Friend, Please visit the following link:ADS_TO_REPLACE_3 http://www.roseindia.net/php/ Thanks
Session
Session   How can we set the inactivity period on a per-session basis?   We can set the session time out programmatically by using the method setMaxInactiveInterval() of HttpSession
How to Prepend Array in PHP
How to Prepend Array in PHP  hi, How can i prepand array in PHP. Please suggest any example of prepand array in PHP program. Thanks,   Hi, The PHP prepand array function in used before adding any elements
Labeling session name .
Labelling session name Setting the variable name to session_name, you can labell the session name.  <?php $name = session_name("ID"); echo "The session name is $name<br />"; ?>ADS_TO_REPLACE_1

Ads