'PHP_SELF'

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Zuprem
-


Joined: 07 Jun 2003
Posts: 5
Location: Bucharest, Romania

PostPosted: Fri Aug 27, 2004 10:44 pm    Post subject: 'PHP_SELF' Reply with quote

'PHP_SELF'
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar.

If PHP is running as a command-line processor, this variable is not available.


this is what i fond in the php manual.. the most important is the last line. i understand from it that i can't use /test.php/foo.bar while i execute my php scripts with php.exe, right?

so, is there any sollution for me? i really love this webserver, and i wouldn't want to change it..
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3724
Location: USA, GA

PostPosted: Sat Aug 28, 2004 1:12 am    Post subject: Reply with quote

Why would you change web servers , any server would do the same thing.
You say your running it from the command line , that has nothing to do
with the web server , its up to you to figure it out , don't blame Abyss.

Example: PHP_SELF
This will only show test.php if you print this to the browser , it will not show
test.php/foo.bar , can you please provide more information on this ? Link ?
_________________
Computer Programmer & Networking Specialist

Back to top View user's profile Send private message Visit poster's website MSN Messenger
Zuprem
-


Joined: 07 Jun 2003
Posts: 5
Location: Bucharest, Romania

PostPosted: Sat Aug 28, 2004 5:32 am    Post subject: Reply with quote

all i know is that when i type http://www.aphphoster.bla/index.php/page/1/type/2/ $_SERVER['PHP_SELF'] returns index.php/page/1/type/2/; if i do that in my Abyss that variable returns only index.php.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
trinity
-


Joined: 11 Nov 2003
Posts: 20
Location: Tampa, FL

PostPosted: Sat Aug 28, 2004 8:03 am    Post subject: Reply with quote

Try setting the "register_globals" directive to "On" in your php.ini configuration and see if that solves your issue.
_________________
Please feel free to visit my websites:
BNBT EasyTracker | The Trinity Forums | The Piscean Realm of ZionMatrix
Back to top View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3724
Location: USA, GA

PostPosted: Sat Aug 28, 2004 8:05 am    Post subject: Reply with quote

that is because index.php is the actual script path , the other is just some
other path , I never even seen PHP with those type paths , Link please !

Where did you find out about some weird path like
index.php/page/1/type/2/ "Your confusing me!"
_________________
Computer Programmer & Networking Specialist

Back to top View user's profile Send private message Visit poster's website MSN Messenger
Zuprem
-


Joined: 07 Jun 2003
Posts: 5
Location: Bucharest, Romania

PostPosted: Sat Aug 28, 2004 8:21 am    Post subject: Reply with quote

http://zuprem.dap.ro/test.php/this/is/a/test/

the server i put this testpage on has register_globals off..
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3724
Location: USA, GA

PostPosted: Sat Aug 28, 2004 8:32 am    Post subject: Reply with quote

Ok now I get it , your saying that it just shows the name of the php file instead of showing
the actual path like /test.php/this/is/a/test/ , I still don't get why you would make up a
path like /test.php/this/is/a/test/ Don't you mean test.php? and so on ? Please more info :/

Edit: I figured out your problem , the reason is because your
using the Apache Web Server , thats full of all kinds of bugs.
_________________
Computer Programmer & Networking Specialist

Back to top View user's profile Send private message Visit poster's website MSN Messenger
Zuprem
-


Joined: 07 Jun 2003
Posts: 5
Location: Bucharest, Romania

PostPosted: Sat Aug 28, 2004 8:44 am    Post subject: Reply with quote

well, that is not my webserver.. yet, this is not a bug.. having a script that uses / instead of ? enables me to trick some programs: the test.php?ed=1&bed=2 is viewed as file test.php with some variables set, while test.php/ed/1/bed/2 is viewed as an idependent file, diffrent from test.php
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3724
Location: USA, GA

PostPosted: Sat Aug 28, 2004 8:49 am    Post subject: Reply with quote

I never really seen anything like this so its possible it is a bug on Abyss
that does not correctly handle such a URL , contact Aprelium about this.
_________________
Computer Programmer & Networking Specialist

Back to top View user's profile Send private message Visit poster's website MSN Messenger
senshi
-


Joined: 05 Nov 2003
Posts: 385
Location: UK

PostPosted: Sat Aug 28, 2004 12:30 pm    Post subject: Reply with quote

http://www.aprelium.com/forum/posting.php?mode=reply&t=5332

for example is showing that the URL /posting.php?mode=reply&t=5332 is passed in a method that the server or script is expecting.

The ? indicates that anything past it "mode=reply&t=5332" is the content/datastring what ever youwant to call it, is read by the CGI script in the "posting.php" page that is called from the server.

I think your method of passing strings to the CGI is causing your issues because you seem to be enforcing your own ideal onto an already established method of passing strings that the browsers and servers are able to easily resolve or are expecting.

As for your 'Trick' ... Trick what exactly?
Back to top View user's profile Send private message
Zuprem
-


Joined: 07 Jun 2003
Posts: 5
Location: Bucharest, Romania

PostPosted: Sat Aug 28, 2004 1:13 pm    Post subject: Reply with quote

the bottom line is that this option is avalaible on other webservers, that it is useful, really useful to some people (example: me!) and that Abyss doesn't have it (or we -the ones who posted here till now- don't know how to get access to it).. and i guess that anyone who knows what a reserved / predefined (whatever) variable is (we are talking about $_SERVER['PHP_SELF'], here, right?), also knows about forms and about what the string put after "?" means..
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger
senshi
-


Joined: 05 Nov 2003
Posts: 385
Location: UK

PostPosted: Sat Aug 28, 2004 1:48 pm    Post subject: Reply with quote

well on all server nowadays, '/' refers to the webroot in a URL

if you type http://127.0.0.1 into your browser, it should add a / on the end when connected to the server, it show your in the webroot.

anything after the / webroot is either an alias or a relative path, if the URL contains a ? (the Delimiter) it indicates that the passing string passt that ? is the CGI INFO that the page can read in.

so /cgi-bin/myphpcgi.php?this_is_the_pass_string

If you make up a page using the form submit by using the GET function in HTML, it will pass any value in a URL as a string, POST does pretty much the same but server-side.

The string can easily be read by javascript routines and PHP routines as thats pretty much the standard that these languages are expecting the URL to arrive or be passed like.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group