|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
including a folder
hi. How do i include what ever comes after the "/" in my domainname ?... so that i dont have to write "http://domain/?page=pageName.php" but can write "http://domain/pageName" and then it treats it like a .php file and includes it in the given include(); function. ???
- Pheifel |
|
#2
|
||||
|
||||
|
There is a mod for apache that you can use to do that.. it's installed here on devarts, or at least it was, for viewing the articles.. give me some time, i'll do my research and find out what it is called again.. or maybe one of the other mods knows off the top of their heads what it is called.
*Edit* I found what i was looking for, please reference this thread and let me know if you have any other questions |
|
#3
|
|||
|
|||
|
mod_rewrite
|
|
#4
|
|||
|
|||
|
well... the point is, that i dont have physical acces to the server. Is ther no way to code the php tag to take enything after the last "/" and convert into "*.php" ??
- Pheifel |
|
#5
|
||||
|
||||
|
It's possible that you could pass everything through index.php and use the PATH_INFO environment variable to grab whatever's on the end. So in index.php, you'd have something like the following:
PHP Code:
In short, if you don't provide a file name (index.php), many servers will assume index.php without rewriting the URL. The PATH_INFO environment variable consists of whatever follows a slash after the URI. So if you had a file named test.php in your directory that contained the text "This is a test" and you used the code above, browsing to http://localhost/test, you should get a page that reads "This is a test."
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#6
|
||||
|
||||
|
You should always be very careful, incidentally, about what you allow people to include. You might add code to split $path on slashes, for example, and take only the last element, forcing a check for that filename within the current directory. This prevents people from being able to specify filenames outside the directory you want them to have access to. Always validate, in other words.
|
|
#7
|
|||
|
|||
|
thanx
![]() - pheifel Last edited by Pheifel : June 17th, 2004 at 04:33 AM. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > including a folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|