Apache: create a password protected directory

It’s is useful to protect a directory with a password and to allow a directory index. In order to this you need to create a .htaccess file in the directory you created, with these┬álines: AuthType Basic AuthName "Restricted Files" AuthBasicProvider file AuthUserFile /usr/local/apache2/bin/.htpassword Require valid-user Options +Indexes IndexOptions FancyIndexingAuthType Basic AuthName "Restricted Files" AuthBasicProvider file
Continue reading Apache: create a password protected directory

PHP: get the request method

This snippet can be used to get the request method: switch ($_SERVER[’REQUEST_METHOD’]) { case ‘GET’: $params = empty($_GET) ? null : $_GET; break; case ‘POST’: $params = empty($_POST) ? null : $_POST; break; }switch ($_SERVER[‘REQUEST_METHOD’]) { case ‘GET’: $params = empty($_GET) ? null : $_GET; break; case ‘POST’: $params = empty($_POST) ? null : $_POST;
Continue reading PHP: get the request method