downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<session_namesession_register>
Last updated: Thu, 26 Jun 2008

session_regenerate_id

(PHP 4 >= 4.3.2, PHP 5)

session_regenerate_id — Update the current session id with a newly generated one

Description

bool session_regenerate_id ([ bool $delete_old_session ] )

session_regenerate_id() will replace the current session id with a new one, and keep the current session information.

Parameters

delete_old_session

Whether to delete the old associated session file or not. Defaults to FALSE.

Return Values

Returns TRUE on success or FALSE on failure.

ChangeLog

Version Description
4.3.3 Since then, if session cookies are enabled, use of session_regenerate_id() will also submit a new session cookie with the new session id.
5.1.0 Added the delete_old_session parameter.

Examples

Example #1 A session_regenerate_id() example

<?php
session_start
();

$old_sessionid = session_id();

session_regenerate_id();

$new_sessionid = session_id();

echo
"Old Session: $old_sessionid<br />";
echo
"New Session: $new_sessionid<br />";

print_r($_SESSION);
?>



add a noteadd a note User Contributed Notes
Update the current session id with a newly generated one
There are no user contributed notes for this page.




<session_namesession_register>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs