CVS update: php3/functions

From: Date: Tue, 13 Apr 1999 13:26:13 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5028@lists.php.net to get a copy of this message
Date: Tuesday April 13, 1999 @ 9:26 Author: fmk Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv5531 Modified Files: head.c head.h Log Message: Making SetCookie callable from other modules Index: php3/functions/head.c diff -c php3/functions/head.c:1.114 php3/functions/head.c:1.115 *** php3/functions/head.c:1.114 Sun Mar 7 15:55:39 1999 --- php3/functions/head.c Tue Apr 13 09:26:13 1999 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.114 1999/03/07 20:55:39 sas Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.115 1999/04/13 13:26:13 fmk Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 432,441 **** return (ret); } ! /* php3_SetCookie(name,value,expires,path,domain,secure) */ ! /* {{{ proto void setcookie(string name[, string value[, int expires[, string path[, string domain[, string secure]]]]]) ! Send a cookie */ ! void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS) { #if !APACHE char *tempstr; --- 432,438 ---- return (ret); } ! void _php3_SetCookie(char * name, char * value, time_t expires, char * path, char * domain, int secure) { #if !APACHE char *tempstr; *************** *** 446,486 **** time_t t; char *r, *dt; #endif - char *name = NULL, *value = NULL, *path = NULL, *domain = NULL; - time_t expires = 0; - int secure = 0; - pval *arg[6]; - int arg_count; - TLS_VARS; - - arg_count = ARG_COUNT(ht); - if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - if (GLOBAL(php3_HeaderPrinted) == 1) { - php3_error(E_WARNING, "Oops, php3_SetCookie called after header has been sent\n"); - return; - } - switch (arg_count) { - case 6: - convert_to_boolean_long(arg[5]); - secure = arg[5]->value.lval; - case 5: - convert_to_string(arg[4]); - domain = estrndup(arg[4]->value.str.val,arg[4]->value.str.len); - case 4: - convert_to_string(arg[3]); - path = estrndup(arg[3]->value.str.val,arg[3]->value.str.len); - case 3: - convert_to_long(arg[2]); - expires = arg[2]->value.lval; - case 2: - convert_to_string(arg[1]); - value = estrndup(arg[1]->value.str.val,arg[1]->value.str.len); - case 1: - convert_to_string(arg[0]); - name = estrndup(arg[0]->value.str.val,arg[0]->value.str.len); - } #if APACHE php3_PushCookieList(name, value, expires, path, domain, secure); #else --- 443,448 ---- *************** *** 562,567 **** --- 524,572 ---- if (value) efree(value); efree(tempstr); #endif + } + + /* php3_SetCookie(name,value,expires,path,domain,secure) */ + /* {{{ proto void setcookie(string name[, string value[, int expires[, string path[, string domain[, string secure]]]]]) + Send a cookie */ + void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS) + { + char *name = NULL, *value = NULL, *path = NULL, *domain = NULL; + time_t expires = 0; + int secure = 0; + pval *arg[6]; + int arg_count; + TLS_VARS; + + arg_count = ARG_COUNT(ht); + if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) { + WRONG_PARAM_COUNT; + } + if (GLOBAL(php3_HeaderPrinted) == 1) { + php3_error(E_WARNING, "Oops, php3_SetCookie called after header has been sent\n"); + return; + } + switch (arg_count) { + case 6: + convert_to_boolean_long(arg[5]); + secure = arg[5]->value.lval; + case 5: + convert_to_string(arg[4]); + domain = estrndup(arg[4]->value.str.val,arg[4]->value.str.len); + case 4: + convert_to_string(arg[3]); + path = estrndup(arg[3]->value.str.val,arg[3]->value.str.len); + case 3: + convert_to_long(arg[2]); + expires = arg[2]->value.lval; + case 2: + convert_to_string(arg[1]); + value = estrndup(arg[1]->value.str.val,arg[1]->value.str.len); + case 1: + convert_to_string(arg[0]); + name = estrndup(arg[0]->value.str.val,arg[0]->value.str.len); + } + _php3_SetCookie(name, value, expires, path, domain, secure); } /* }}} */ Index: php3/functions/head.h diff -c php3/functions/head.h:1.24 php3/functions/head.h:1.25 *** php3/functions/head.h:1.24 Fri Jan 1 12:59:10 1999 --- php3/functions/head.h Tue Apr 13 09:26:13 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: head.h,v 1.24 1999/01/01 17:59:10 zeev Exp $ */ #ifndef _HEAD_H #define _HEAD_H --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: head.h,v 1.25 1999/04/13 13:26:13 fmk Exp $ */ #ifndef _HEAD_H #define _HEAD_H *************** *** 57,62 **** --- 57,63 ---- extern int php3_init_head(INIT_FUNC_ARGS); extern void php3_Header(INTERNAL_FUNCTION_PARAMETERS); + extern void _php3_SetCookie(char * name, char * value, time_t expires, char * path, char * domain, int secure); extern void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS); extern void php3_noheader(void); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5028) next »