Date: 07/13/98
- Next message: chrism: "Re: [PHP-DEV] Bug #548: use of object variables within object"
- Previous message: Bug Database: "[PHP-DEV] Bug #544 Updated: Header() does not behave properly sometimes"
- Next in thread: Stig S. Bakken: "Re: [PHP-DEV] apache + notes"
- Reply: Stig S. Bakken: "Re: [PHP-DEV] apache + notes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Here's a diff against 3.0.2-dev for a function to get and set values in
apache's "notes" table. This can be especially useful for logging -- i
do cookie based authentication via PHP, so once my PHP figures out the
username from the various things in the cookie, it can stick it in a
note, and then mod_log_config can grab the note and log the username
with the request.
-dave
-----------
--- apache.c.orig Mon Jul 13 15:07:10 1998
+++ apache.c Mon Jul 13 15:04:58 1998
@@ -54,16 +54,46 @@
void php3_getallheaders(INTERNAL_FUNCTION_PARAMETERS);
void php3_apachelog(INTERNAL_FUNCTION_PARAMETERS);
void php3_info_apache(void);
+void php3_apache_note(INTERNAL_FUNCTION_PARAMETERS);
function_entry apache_functions[] = {
{"virtual", php3_virtual, NULL},
{"getallheaders", php3_getallheaders, NULL},
+ {"apache_note", php3_apache_note,NULL},
{NULL, NULL, NULL}
};
php3_module_entry apache_module_entry = {
"Apache", apache_functions, NULL, NULL, NULL, NULL, php3_info_apache, STANDARD_MODULE_PROPERTIES
};
+
+
+void php3_apache_note(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *arg_name,*arg_val;
+ char *note_val;
+ int arg_count = ARG_COUNT(ht);
+TLS_VARS;
+
+ if (arg_count<1 || arg_count>2 ||
+ getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(arg_name);
+ note_val = (char *) table_get(GLOBAL(php3_rqst)->notes,arg_name->value.str.val);
+
+ if (arg_count == 2) {
+ convert_to_string(arg_val);
+ table_set(GLOBAL(php3_rqst)->notes,arg_name->value.str.val,arg_val->value.str.val);
+ }
+
+ if (note_val) {
+ RETURN_STRING(note_val,0);
+ } else {
+ RETURN_FALSE;
+ }
+}
void php3_info_apache(void) {
module *modp = NULL;
- Next message: chrism: "Re: [PHP-DEV] Bug #548: use of object variables within object"
- Previous message: Bug Database: "[PHP-DEV] Bug #544 Updated: Header() does not behave properly sometimes"
- Next in thread: Stig S. Bakken: "Re: [PHP-DEV] apache + notes"
- Reply: Stig S. Bakken: "Re: [PHP-DEV] apache + notes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

