Skip to content

Instantly share code, notes, and snippets.

@SemanticallyNull
Created March 1, 2013 17:56
Show Gist options
  • Save SemanticallyNull/5066471 to your computer and use it in GitHub Desktop.
Save SemanticallyNull/5066471 to your computer and use it in GitHub Desktop.
<?php
if (!(
isset($_SERVER['PHP_AUTH_USER'])
&& 'username' == $_SERVER['PHP_AUTH_USER']
&& isset($_SERVER['PHP_AUTH_PW'])
&& sha1('password') == sha1($_SERVER['PHP_AUTH_PW'])
)) {
header('WWW-Authenticate: Basic realm="Orchestra"');
header('HTTP/1.0 401 Unauthorized');
echo "You must authenticate to use this site.\n\n";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment