Added session_is_registered(varname) function.

This commit is contained in:
Andrey Hristov 1999-06-28 15:46:56 +00:00
parent 17f725d21a
commit a6aacfd2b6
2 changed files with 28 additions and 0 deletions

View 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);

View 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)