ID:               3305
 Comment by:       o6y1 at hotmail dot com
 Reported By:      joel at nextstudio dot com
 Status:           Closed
 Bug Type:         Other
 Operating System: Solaris 2.6
 PHP Version:      4.0 Beta 3
 New Comment:

��� ���� ��� �������


Previous Comments:
------------------------------------------------------------------------

[2000-01-24 17:47:28] torben at cvs dot php dot net

This is a scoping problem, not a bug. Remember, global variables are
not available by default inside functions. Add the following line:

   global $SERVER_NAME, $REQUEST_URI, $REMOTE_ADDR, $QUERY_STRING;

as the first line of your function to allow access to those globals
within
status_mail().

Torben

------------------------------------------------------------------------

[2000-01-24 17:38:38] joel at nextstudio dot com

$SERVER_NAME, $REQUEST_URI, and $QUERY_STRING aren't being echoed out
in the email body.  They work fine in the from and reply-to headers,
though.

Here's what i get in my email:

-- begin email snippet --
Date: Mon, 24 Jan 2000 14:25:08 -0800
Message-Id: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Success
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
X-Mailer: PHP/4.0b3
Sender: [EMAIL PROTECTED]

Zip search database rebuilt.

Num of records: 8711

Monday, January 24, 2000  02:25:08 pm
HOST: , URI: 
REMOTE_ADDR: 

-- end email snippet

Below is the code that I used to generate the above response.

-- begin script snippet1 --

/*
 * bool status_mail(bool end, string subj, string message, string
recpt)
 *
 * email result status
 */
function status_mail($bomb, $subj, $msg, $recpt="[EMAIL PROTECTED]")
{
        $r = mail($recpt, $subj, $msg."\n\n".date("l, F j, Y  h:i:s a")."\n".
                "HOST: ".$SERVER_NAME.", URI: ".$REQUEST_URI.$QUERY_STRING."\n".
                "REMOTE_ADDR: ".$REMOTE_ADDR."\n",
                "From: webmaster".$SERVER_NAME."\nReply-To:
webmaster".$SERVER_NAME."\nX-Mailer: PHP/".
                phpversion());
        
        if ($bomb)
                die($subj.": ".$msg);
        else
                echo $subj.": ".$msg;
                
        return $r;
}

-- end script snippet1 --

It's in it's own include file which is then called as:

-- start script snippet2 --

status_mail(false, "Success", "Zip search database rebuilt.\n\nNum of
records: ".$i);

-- end script snippet2 --

$i is an int if that makes any difference.

Any ideas?

Joel

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=3305&edit=1

Reply via email to