1 diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c
2 --- php-4.2.3.org/ext/standard/mail.c Tue Oct 29 21:35:04 2002
3 +++ php-4.2.3/ext/standard/mail.c Tue Oct 29 21:33:03 2002
11 #include "ext/standard/info.h"
12 #if !defined(PHP_WIN32)
14 #include "safe_mode.h"
17 +#include "zend_operators.h"
19 +#include "zend_globals.h"
23 #include "win32/sendmail.h"
28 - fprintf(sendmail, "To: %s\n", to);
29 - fprintf(sendmail, "Subject: %s\n", subject);
32 + if ((to != NULL) && (strlen(to)!=0)) {
33 + fprintf(sendmail, "To: %s\n", to);
35 + if ((subject != NULL) && (strlen(subject)!=0)) {
36 + fprintf(sendmail, "Subject: %s\n", subject);
39 + if (PG(http_globals)[TRACK_VARS_SERVER]) {
40 + zval **remote_addr, **server_name, **server_port,
41 + **request_uri, **http_user_agent;
43 + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) {
44 + convert_to_string_ex(remote_addr);
45 + fprintf(sendmail, "HTTP-Posting-Client: %s\n", Z_STRVAL_PP(remote_addr));
47 + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &server_name)==SUCCESS) {
48 + convert_to_string_ex(server_name);
49 + fprintf(sendmail, "HTTP-Posting-URI: %s", Z_STRVAL_PP(server_name));
50 + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_PORT", sizeof("SERVER_PORT"), (void **) &server_port)==SUCCESS) {
51 + convert_to_string_ex(server_port);
52 + fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port));
54 + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &request_uri)==SUCCESS) {
55 + convert_to_string_ex(request_uri);
56 + fprintf(sendmail, "%s", Z_STRVAL_PP(request_uri));
58 + fprintf(sendmail, "\n");
60 + if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent)==SUCCESS) {
61 + convert_to_string_ex(http_user_agent);
62 + fprintf(sendmail, "HTTP-Posting-User-Agent: %s\n", Z_STRVAL_PP(http_user_agent));
66 if (headers != NULL) {
67 fprintf(sendmail, "%s\n", headers);