|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
access protected folder
Hello,
I am using php in my website. I have a protected folder and php scripts in it. i have a php outside the protected folder also. How can i access the protected folder using php. For example - there is a folder reg and inside there a protected folder pr. username is abc password is 123. i want when i click on php script it opens a script in folder pr using username and password automatically. Please help. Thanks |
|
#2
|
|||
|
|||
|
RE: access protected folder
If you just want to access a file in a protected folder, you can do that without doing anything...just use the file() function or fopen() to open it. Don't use an http:// name, just use a file system name ...like :
$file = file('./pr/somefile.txt'); When you access a file in this way, it goes around .htaccess and the likes... |
|
#3
|
|||
|
|||
|
RE: access protected folder
I think your verbage means you want to be able to have a link to a protected file. If so, http://user:pass@URL/, would be the format to automatically login as user and pass.
|
|
#4
|
|||
|
|||
|
RE: access protected folder
Actually, the easiest way to do it is like this:
whatever folder your HTML is in, let's call it "public_html" is what apache recognizes as the web root. However, PHP can read anywhere on the server, so a file in the web root could read a file NOT ACCESSIBLE OVER THE INTERNET as long as it's on your server. If your web root is /home/web/public_html, you might put your scripts in /home/web/scripts and call the script like so: from, let's say, index.php in the root- |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > access protected folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|