Skip to content

Instantly share code, notes, and snippets.

@nielk
Created August 29, 2013 15:30
Show Gist options
  • Save nielk/6379571 to your computer and use it in GitHub Desktop.
Save nielk/6379571 to your computer and use it in GitHub Desktop.
content protected with password on drupal
<?php
// Add this into PHP code
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
if (!isset($_SERVER['PHP_AUTH_USER'])
|| $username != "qwerty" || $password != "qwerty") {
header('WWW-Authenticate: Basic realm="Please Login"');
header('HTTP/1.0 401 Unauthorized');
print 'Sorry, incorrect password or username.';
exit;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment