Re: php scripts and tripple slashes




mijn naam schreef:
"Erwin Moller" <Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx> schreef in bericht news:48e0d358$0$182$e4fe514c@xxxxxxxxxxxxxxxxx

mijn naam schreef:
"Erwin Moller" <Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx> schreef in bericht news:48e0cabf$0$185$e4fe514c@xxxxxxxxxxxxxxxxx

I bet you are using mod_rewrite for apache.
Have a look at the rewrite rules and conditions in your apache config.
Post it here if you are in doubt. Or better here: alt.apache.configuration

Thanks but no.

One machine is the provider's. I cannot look there.

The other one is my home box, this one doesn't do rewriting AFACT. Just to be sure: I placed RewriteLogLevel 2 and RewriteLog logs/rewrite in the config and that log stays empty.

Then I commented everything having to do with rewriting out, and restarted apache. Before and after the following happens on my machine:

_SERVER["REQUEST_URI"]=/debug/one/two///three/four
_SERVER["SCRIPT_NAME"]=/debug/one/two/debug.php
_SERVER["PHP_SELF"]=/debug/one/two/debug.php/one/two/three/four


Hi Stranger,

And what URL are you feeding excactly that gives the above result?


Hi Mijn,

http://hostname/debug/one/two///three/four

in other words: http://{$_SERVER["SERVER_NAME"]}{$_SERVER["REQUEST_URI"]}

OK, that makes sense then for $_SERVER["REQUEST_URI"].

I don't see how/why PHP fills $_SERVER["PHP_SELF"] with:
/debug/one/two/debug.php/one/two/three/four
for that URL if you don't play with mod_rewrite.

Your url:
http://hostname/debug/one/two///three/four
DOESN'T name any php script, so HOW is this fed to a PHP script without mod_rewrite???

Are you sure you are telling the whole story?



And secondly: What is it excactly you are trying to achieve?
Do you have an actual problem or is this just research?

I'm writing a script which is going to be used to find files in a directory structure. That script looks like a subdirectory in the normal tree.

E.g. http://servername/content/a/b/c/d will look at /home/user/private_html/a/b/c/d

While testing my script with various different problems ('never trust user input') I found the problem I'm trying to tackle.

I was using _SERVER["SCRIPT_NAME"] but obviously I run into trouble if I can't rely on its contents.

The only workaround I've found so far is to redirect(ereg_replace('///*','/',$_SERVER["REQUEST_URI"])) in case I find two slashes in a row in request_uri. Not a nice solution but it seems to do the job.

What about simply dismissing a request that has more than one / in the URL?
That must be an invalid request, since (I expect) you deliver the directorylinks yourself, and thus correctly formatted.




PS: Please 'mijn naam', use a (real) name, that makes conversations in here a bit more pleasant. ;-)

Just call me 'Mijn'. No problem.

Fine I will call you Mijn.
It just feels a little too intimate since I am Dutch too. ;-)


Regards,
Erwin Moller

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
.



Relevant Pages

  • Re: Script File Error
    ... Ivailo Tanusheff wrote: ... You may correct the script by changing: ... I corrected it by rewriting it like ... Never argue with a fool. ...
    (freebsd-questions)
  • Re: CGI -> mod_python
    ... it is a kind of nooby question. ... Is there a way to transfer a CGI python ... script to mod_python without rewriting the code? ...
    (comp.lang.python)
  • Re: php scripts and tripple slashes
    ... Have a look at the rewrite rules and conditions in your apache config. ... Then I commented everything having to do with rewriting out, ... I'm writing a script which is going to be used to find files in a directory structure. ...
    (comp.lang.php)
  • Re: ESRs fortune.pl redone in python - request for critique
    ... Adelein and Jeremy wrote: ... > I have recently completed a mini-project with the goal of rewriting ... > in Python Eric Raymond's fortune.pl script ...
    (comp.lang.python)
  • Re: php scripts and tripple slashes
    ... Have a look at the rewrite rules and conditions in your apache config. ... Then I commented everything having to do with rewriting out, ... Erwin Moller ... Please 'mijn naam', use a name, that makes conversations in here a bit more pleasant. ...
    (comp.lang.php)