]> granicus.if.org Git - php/commitdiff
Added session_is_registered(varname) function.
authorAndrey Hristov <andrey@php.net>
Mon, 28 Jun 1999 15:46:56 +0000 (15:46 +0000)
committerAndrey Hristov <andrey@php.net>
Mon, 28 Jun 1999 15:46:56 +0000 (15:46 +0000)
ext/session/php_session.h
ext/session/session.c

index 356a24f605ed254bba92180dffd847dc18850fe4..740754a2fa4f6538e40adb4b4c15ad5ff9484fff 100644 (file)
@@ -96,6 +96,7 @@ PHP_FUNCTION(session_id);
 PHP_FUNCTION(session_decode);
 PHP_FUNCTION(session_register);
 PHP_FUNCTION(session_unregister);
+PHP_FUNCTION(session_is_registered);
 PHP_FUNCTION(session_encode);
 PHP_FUNCTION(session_start);
 PHP_FUNCTION(session_destroy);
index 9396d0dce90dce0f4cb01d5e3bba7dda915147d5..79483d15f2c17298a0492354a5d4c78a7f8aed6e 100644 (file)
@@ -65,6 +65,7 @@ function_entry session_functions[] = {
        PHP_FE(session_decode, NULL)
        PHP_FE(session_register, NULL)
        PHP_FE(session_unregister, NULL)
+       PHP_FE(session_is_registered, NULL)
        PHP_FE(session_encode, NULL)
        PHP_FE(session_start, NULL)
        PHP_FE(session_destroy, NULL)
@@ -473,6 +474,32 @@ PHP_FUNCTION(session_unregister)
 }
 /* }}} */
 
+
+/* {{{ proto bool session_is_registered(string varname)
+   checks if a variable is registered in session */
+PHP_FUNCTION(session_is_registered)
+{
+       pval *p_name;
+       pval *p_var;
+       int ac = ARG_COUNT(ht);
+       PSLS_FETCH();
+
+       if(ac != 1 || getParameters(ht, ac, &p_name) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+       
+       convert_to_string(p_name);
+       
+       if (zend_hash_find(&PS(vars), p_name->value.str.val, p_name->value.str.len+1,
+                                          (void **)&p_var) == SUCCESS) {
+               RETURN_TRUE;
+       } else {
+               RETURN_FALSE;
+       }
+}
+/* }}} */
+
+
 /* {{{ proto string session_encode()
    serializes the current setup and returns the serialized representation */
 PHP_FUNCTION(session_encode)