Languages :: PHP :: php script to give password |
|||
| By: PHP newbee |
Date: 06/09/2003 00:00:00 |
Points: 100 | Status: Answered Quality : Excellent |
|
Hello I search hotscripts.com but I do not find a php scripts to give a file / a directory password. I would like to say that I want to give password inside cgi-bin directory. Before I find one php script which works fine but I lost that one. |
|||
| By: VGR | Date: 06/09/2003 06:10:00 | Type : Comment |
|
| ? you can chmod(), chown() but to set a directory password ?!!? |
|||
| By: Zvonko | Date: 06/09/2003 07:42:00 | Type : Comment |
|
| That is a web server option, not a php option. php is a page content processor. It transforms your html code with a php tags to new html code to send it to browser. So is accessing the page or directory already done before your php engine gets the page input for processing. |
|||
| By: pfiev | Date: 07/09/2003 20:11:00 | Type : Comment |
|
| This is a php script that requires password: ------------------ <?php $shellUser = 'admin'; $shellPswd = 'hn4ucom'; $shellArea = 'Administration'; if (empty($_SERVER['PHP_AUTH_USER'])) { Header('WWW-Authenticate: Basic realm="My Realm"'); Header('HTTP/1.0 401 Unauthorized'); echo 'Your username/password is required.'; exit; } else if ($_SERVER['PHP_AUTH_USER']!=$shellUser || $_SERVER['PHP_AUTH_PW']!=$shellPswd) { echo " <html> <head> <title>$shellArea - Your access is banned!</title> </head> <h1>Error access</h1> You tried to access the area where you are not allowed. <hr> <em>$shellArea</em>"; exit; } // something after that // .... ?> ------------------ But you need help of web server: use .htaccess for Apache 1/ use mod_rewrite to redirect all to your script above, it will filter some things unnecessary.. 2/ just .htaccess, you can protect your file/folder Both of them can be found at apache.org, in Documentation |
|||
| By: VGR | Date: 07/09/2003 20:58:00 | Type : Answer |
|
| all those "solutions" are not even close to "a password on a directory or file" |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








