Skip to content

Instantly share code, notes, and snippets.

@jeonghwan-kim
Created October 19, 2013 08:57
Show Gist options
  • Select an option

  • Save jeonghwan-kim/7053329 to your computer and use it in GitHub Desktop.

Select an option

Save jeonghwan-kim/7053329 to your computer and use it in GitHub Desktop.
html authorization
<?php
$username = 'user name';
$password = 'password';
$range = 'range';
if (!isset($_SERVER['PHP_AUTH_USER']) ||
!isset($_SERVER['PHP_AUTH_PW']) ||
($_SERVER['PHP_AUTH_USER'] != $username) ||
($_SERVER['PHP_AUTH_PW'] != $password))
{
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm= "'.$range.'"');
exit('<p>Access denied.</p>');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment