[Xitami] $PHP_SELF variable
Paul N Shortis
xitami@lists.xitami.org
Wed, 14 Nov 2001 09:45:06 +1000
--0__=8M7op4MRVL1Zv4mEu0fS8SQh96FFLWW20Fq1q0xVQxPncZYpiO0U01G2
Content-type: text/plain; charset="us-ascii"
Content-Disposition: inline
Just a little something that I used when I came across this difference between
Apache & Xitami. This will run
on either Apache or Xitami, I didn't wrap it in a function as it is only
executed once at the beginning of a new
session in my application.
Hope you find this of some help.
$session->RootPath = stripSlashes( dirname( $PATH_TRANSLATED)); //
Assume we are in the root dir
$session->BasePath = basename( $session->RootPath);
// Assume we are one directory below the resource root
if( strlen( trim($PHP_SELF))) $session->BaseURL = dirname( $PHP_SELF);
// & that this matches BasePath - this works with Apache
else // Xitami ???
{
// This works for Xitami
$url = parse_url($HTTP_REFERER);
$session->BaseURL = dirname( $url["path"]);
}
Regards, Paul Shortis
Fabian Bess <fbess@gmx.net> on 11/13/2001 05:28:36 PM
Please respond to xitami@lists.xitami.org
To: xitami@lists.xitami.org
cc: (bcc: Paul N Shortis/Roads/QMR/Au)
Subject: Re: [Xitami] $PHP_SELF variable
Paul Reid wrote:
>> Since Version 2.4d5 (or d4 I'm not sure) this PHP variable which should be
filled with the calling script's filename is empty.
>>
>
>Which Version Of PHP ???
>
latest PHP 4.0.6
>The current version of PHP changed which variable it uses to find its
>script. The PHP site documents this as a security issue. Xitami does not
>(AFAIK, never did) fill this variable.
>
Well, it did on Xitami sometime and it still does with Apache.
>I had a BAT file which patched this under DOS/Win. It was posted here
>last year. Unfortunately I lost most of my older messages since then. I
>*think* the trick is to SET PATH_INFO the same as SCRIPT_PATH and then
>call PHP.
>
Maybe you could describe this a little more in detail to me? Not on the list but
in private?
--
Fabian Bess (webmaster@tannenhof.de)
Webmaster Drogenhilfe Tannenhof Berlin e.V. 'http://www.tannenhof.de'
************************************************************
Opinions contained in this e-mail do not necessarily reflect
the opinions of the Queensland Department of Main Roads,
Queensland Transport or National Transport Secretariat, or
endorsed organisations utilising the same infrastructure.
If you have received this electronic mail message in error,
please immediately notify the sender and delete the message
from your computer.
************************************************************
--0__=8M7op4MRVL1Zv4mEu0fS8SQh96FFLWW20Fq1q0xVQxPncZYpiO0U01G2
Content-type: text/html;
name="att1.htm"
Content-Disposition: attachment; filename="att1.htm"
Content-transfer-encoding: base64
Content-Description: Internet HTML
PGh0bWw+DQo8aGVhZD4NCjwvaGVhZD4NCjxib2R5Pg0KUGF1bCBSZWlkIHdyb3RlOjxicj4NCjxi
bG9ja3F1b3RlIHR5cGU9ImNpdGUiIGNpdGU9Im1pZDozQkYwMThGRi43N0MzMTZGMUByY2kucnV0
Z2Vycy5lZHUiPg0KICA8YmxvY2txdW90ZSB0eXBlPSJjaXRlIj4NCiAgICA8cHJlIHdyYXA9IiI+
IFNpbmNlIFZlcnNpb24gMi40ZDUgKG9yIGQ0IEknbSBub3Qgc3VyZSkgdGhpcyBQSFAgdmFyaWFi
bGUgd2hpY2ggc2hvdWxkIGJlIGZpbGxlZCB3aXRoIHRoZSBjYWxsaW5nIHNjcmlwdCdzIGZpbGVu
YW1lIGlzIGVtcHR5LiA8YnI+PC9wcmU+DQogICAgPC9ibG9ja3F1b3RlPg0KICAgIDxwcmUgd3Jh
cD0iIj48IS0tLS0+PGJyPldoaWNoIFZlcnNpb24gT2YgUEhQID8/PzwvcHJlPg0KICAgIDwvYmxv
Y2txdW90ZT4NCmxhdGVzdCBQSFAgNC4wLjY8YnI+DQogICAgPGJsb2NrcXVvdGUgdHlwZT0iY2l0
ZSIgY2l0ZT0ibWlkOjNCRjAxOEZGLjc3QzMxNkYxQHJjaS5ydXRnZXJzLmVkdSI+DQogICAgICA8
cHJlIHdyYXA9IiI+VGhlIGN1cnJlbnQgdmVyc2lvbiBvZiBQSFAgY2hhbmdlZCB3aGljaCB2YXJp
YWJsZSBpdCB1c2VzIHRvIGZpbmQgaXRzPGJyPnNjcmlwdC4gVGhlIFBIUCBzaXRlIGRvY3VtZW50
cyB0aGlzIGFzIGEgc2VjdXJpd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