List Info

Thread: note 61591 added to function.header




note 61591 added to function.header
user name
2006-02-07 13:10:55
I think that the location example ins't valid anymore, at
least in my environment (*nix+apache, php4.10);
It says:

header ("Location: http://".$HTTP_SERVER_VARS['H
TTP_HOST'].
"/".dirname($HTTP_SERVER_VARS['PHP_SELF']).
"/".$relative_url);

but in my environment
"/".dirname($HTTP_SERVER_VARS['PHP_SELF']) outputs
a double slash (//) in front fo the dirname causing php non
to follow the expected redirection.
This is because $HTTP_SERVER_VARS['PHP_SELF']) adds a
leading slash to the dirname.

I solved by omitting the '/' between the HTTP_HOST and the
PHP_SELF.
In addiction probably is better, if not the same, to use the
$_SERVER instead of the $HTTP_SERVER_VARS.

Hope my 2 cents could be useful for someone.
----
Server IP: 213.92.11.19
Probable Submitter: 195.62.164.225 (proxied: 172.20.1.143)
----
Manual Page -- http
://www.php.net/manual/en/function.header.php
Edit        -- http://master.php.net/manage/user-notes.php?action=
edit+61591
Delete: added to the manual -- htt
p://master.php.net/manage/user-notes.php?action=delete+61591
&report=yes&reason=added+to+the+manual
Delete: bad code            -- http://master.
php.net/manage/user-notes.php?action=delete+61591&report
=yes&reason=bad+code
Delete: spam                -- http://master.php.
net/manage/user-notes.php?action=delete+61591&report=yes
&reason=spam
Delete: useless             -- http://master.p
hp.net/manage/user-notes.php?action=delete+61591&report=
yes&reason=useless
Delete: non-english         -- http://mast
er.php.net/manage/user-notes.php?action=delete+61591&rep
ort=yes&reason=non-english
Delete: already in docs     -- http://
master.php.net/manage/user-notes.php?action=delete+61591&
;report=yes&reason=already+in+docs
Delete: other reasons       -- http://master.php.net/manage/user-
notes.php?action=delete+61591&report=yes
Reject      -- http://master.php.net/manage/user-
notes.php?action=reject+61591&report=yes
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61591 rejected from function.header by tularis
user name
2006-02-07 14:11:26
Note Submitter: effeesse at gmail dot com 

----

I think that the location example ins't valid anymore, at
least in my environment (*nix+apache, php4.10);
It says:

header ("Location: http://".$HTTP_SERVER_VARS['H
TTP_HOST'].
"/".dirname($HTTP_SERVER_VARS['PHP_SELF']).
"/".$relative_url);

but in my environment
"/".dirname($HTTP_SERVER_VARS['PHP_SELF']) outputs
a double slash (//) in front fo the dirname causing php non
to follow the expected redirection.
This is because $HTTP_SERVER_VARS['PHP_SELF']) adds a
leading slash to the dirname.

I solved by omitting the '/' between the HTTP_HOST and the
PHP_SELF.
In addiction probably is better, if not the same, to use the
$_SERVER instead of the $HTTP_SERVER_VARS.

Hope my 2 cents could be useful for someone.

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )