]> granicus.if.org Git - php/commitdiff
add session_regenerate_id()
authorSascha Schumann <sas@php.net>
Tue, 18 Feb 2003 18:50:44 +0000 (18:50 +0000)
committerSascha Schumann <sas@php.net>
Tue, 18 Feb 2003 18:50:44 +0000 (18:50 +0000)
ext/session/php_session.h
ext/session/session.c

index 72b67c6a5346ab9d7595a4f847b330e3d3683423..4e850807ecc856022b6402689ebc567174e4f961 100644 (file)
@@ -132,6 +132,7 @@ PHP_FUNCTION(session_name);
 PHP_FUNCTION(session_module_name);
 PHP_FUNCTION(session_save_path);
 PHP_FUNCTION(session_id);
+PHP_FUNCTION(session_regenerate_id);
 PHP_FUNCTION(session_decode);
 PHP_FUNCTION(session_register);
 PHP_FUNCTION(session_unregister);
index d575474cbc513b3b8154b2bf239260d15f91adaa..74398b261d4e61e9470eeb43481068f4ceb18e91 100644 (file)
@@ -61,6 +61,7 @@ function_entry session_functions[] = {
        PHP_FE(session_module_name,       NULL)
        PHP_FE(session_save_path,         NULL)
        PHP_FE(session_id,                NULL)
+       PHP_FE(session_regenerate_id,     NULL)
        PHP_FE(session_decode,            NULL)
        PHP_FE(session_register,          NULL)
        PHP_FE(session_unregister,        NULL)
@@ -1358,6 +1359,20 @@ PHP_FUNCTION(session_id)
 }
 /* }}} */
 
+/* {{{ proto string session_regenerate_id()
+   Update the current session id with a newly generated one. */
+PHP_FUNCTION(session_regenerate_id)
+{
+       if (PS(mod)) {
+               if (PS(id)) efree(PS(id));
+       
+               PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
+               RETURN_TRUE;
+       }
+       RETURN_FALSE;
+}
+/* }}} */
+
 /* {{{ proto string session_cache_limiter([string new_cache_limiter])
    Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
 PHP_FUNCTION(session_cache_limiter)