분류 php

HTTP Authentication example

컨텐츠 정보

  • 조회 695 (작성일 )

본문

<?php

if(!isset($PHP_AUTH_USER)) {

    Header("WWW-Authenticate: Basic realm=\"My Realm\"");

    Header("HTTP/1.0 401 Unauthorized");

    echo "Text to send if user hits Cancel button\n";

    exit;

} else {

    echo "Hello $PHP_AUTH_USER.<P>";

    echo "You entered $PHP_AUTH_PW as your password.<P>";

}

?> 

php