[PHP] 페이지 접속 암호화
2003.09.25 22:38
6707
187
https://eond.com/20448
object(HotopayModel)#880 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#879 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(27) "coding/20448/comment/465133" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(6) "coding" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(5) { ["page"]=> int(12) ["document_srl"]=> string(5) "20448" ["comment_srl"]=> string(6) "465133" ["mid"]=> string(6) "coding" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

http://miniwini.com/miniwinis/board/index.php?mode=read&bid=qna&id=7531&m=&s=&k=&p=1&op=&sp=&idx=&cid=phpschool에서 어떤 일로 알게된 이혜진님께서 가르쳐준 소스입니다.
윈도우에선 php 함수가 먹히지 않아 안되고 리눅스 서버에서 사용 가능합니다.
페이지 상단에 이 소스를 넣어주면 페이지 접속 시에 아이디 비번을 묻게 하죠.
한 사람만 가능한 걸 보니 관리자 로긴 페이지 정도로 해두죠.
저는 php에 대해 아는 게 없다보니 여러 사람 이렇게 설정하는 건 어떻게 하는지 잘 모르겠네요
^^;
그리고 링크는 의문점이 있어 미니위니에 질문 올린 글이랍니다.
송진석님께서 더 상세히 적어주셨네요 ^_^

<?
################################################################################
#                  김낙회 개인 홈페이지 게시판                                                                       #
#                     Small Company  참조                                       #
################################################################################
#
#
# 수정 : 이혜진
# 수정일 :2001년 8월 9일
#
###############################################################################


/* 취소 클릭 시 */
    function authenticate() {
        
        Header("WWW-authenticate: basic realm="EOND.COM Login Page"");
        Header("HTTP/1.0 401 Unauthorized");
        echo "접속하려면 ID와 PASSWORD가 필요합니다.";
        exit;
    }

/* 확인 클릭 시 (ID와 PASSWORD가 틀렸을 경우) */
function  deauthenticate()  {
    Header( "WWW-authenticate:  basic  realm=EOND.COM Login Page");
    Header( "HTTP/1.0  401  Unauthorized");
    echo  " 적당하지 않은 ID와 PASSWORD 입니다.n";
    exit;
        }


   if(!isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW)) {
        authenticate();
    } else {

        $id=trim(strtolower($PHP_AUTH_USER));        
                $adminid="xynex";

        $password=crypt($PHP_AUTH_PW,'mind');
        $pw =crypt('password','mind');

                if(($password <> $pw) || ($id<>$adminid)){
                        deauthenticate();    
                }
    }
?>

라이믹스는 이온디와 함께

HTML5/CSS3
-
+
닫기

마이페이지

로그인을 해주세요

네이버로 로그인