From: Banana Date: Sun, 12 Feb 2017 09:57:19 +0000 (+0100) Subject: http auth update... X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=d6c63ccd32aa9e1569ff0c56c4c409eb180421e3;p=dolphin.git http auth update... --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..baf6b9d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.buildpath +.project +.settings/ diff --git a/README b/README index 2d30a7d..81f0461 100644 --- a/README +++ b/README @@ -1,2 +1,4 @@ Dolphin is a collection of useful PHP skeletons -v1.1 + +In this collection there are scripts which are made as is. Some are old and are not up to date. +So use at your own risk. \ No newline at end of file diff --git a/authentication/http-auth.php b/authentication/http-auth.php index 5ad1eca..f173e0a 100644 --- a/authentication/http-auth.php +++ b/authentication/http-auth.php @@ -1,7 +1,7 @@ Hello ".$_SERVER['PHP_AUTH_USER'].".

"; - echo "

You entered ".$_SERVER['PHP_AUTH_PW']." as your password.

"; +# place this anywhere you need it. +# define FRONTEND_USERNAME and FRONTEND_PASSWORD as a constand +simpleAuth(); + +function simpleAuth() { + if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) + || $_SERVER['PHP_AUTH_USER'] !== FRONTEND_USERNAME || $_SERVER['PHP_AUTH_PW'] !== FRONTEND_PASSWORD + ) { + header('WWW-Authenticate: Basic realm="Your secret area"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'No Access.'; + exit; + } } + ?> \ No newline at end of file