Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created March 4, 2019 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcko/c0a0041509dca64be0486893d8c45e34 to your computer and use it in GitHub Desktop.
Save Kcko/c0a0041509dca64be0486893d8c45e34 to your computer and use it in GitHub Desktop.
PHP Auth
<?php
if (empty($_SERVER['PHP_AUTH_USER']) ||
$_SERVER['PHP_AUTH_USER'] != "login" ||
$_SERVER['PHP_AUTH_PW'] != "pass") {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Zde nemáte přístup bez jména a hesla';
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment