웹마스터 팁

PHP프로그램을 작성한 후 소스코드 맨 윗부분에 아래의 소스를 삽입하면 됩니다.

그나마 보안에 신경쓰자면 패스워드를 DB에 저장해야겠지만,

쉽게 쓸 수 있는 단순한 관리자인증으로 좋은것같아 공유합니다.

특별한 소스는 아니지만 복사해서 붙여넣기만 하면 된다는 점이 편해서...+_+;;;




* 로그인 후의 내용에 로그아웃을 시켜주는 링크를 빠뜨리지 마세요~_~



<?

$admin_pass = "12345"; //비밀번호 수정해주세요.

// 여기부터 로긴 페이지
if ($action=="login_ok"){
        if ($password==$admin_pass){
                SETCOOKIE(logid, crypt($admin_pass));
        }
        else{
                echo"<script>alert ('비밀번호 틀렸잖아..-_-;;'); history.go(-1);</script>";
                exit;
        }
}
elseif ($logid!=crypt($admin_pass, $logid) || $action=="logout"){        
        if ($action=="logout"){        SETCOOKIE(logid, "");}
        echo"
        <table align='center' cellpadding='0' cellspacing='0' width='100%' height='100%'><form name=password action='$_SERVER[PHP_SELF]' method=post><input type=hidden name=action value=login_ok>
        <tr>
        <td align='center' valign='middle'>
                <table align='center' cellpadding='3' cellspacing='0' width='200'>
                
                <tr>
                        <td style='border-top-width:2px; border-bottom-width:1px; border-top-color:rgb(229,229,229); border-bottom-color:rgb(229,229,229); border-top-style:solid; border-bottom-style:solid;' height='26'>
                        <p align='left' style=font-size:9pt;>비밀번호 확인</p>
                        </td>
                </tr>
                
                <tr>
                        <td style='border-bottom-width:1px; border-bottom-color:rgb(229,229,229); border-bottom-style:solid;'>
                                <p align='center'><input type='password' name='password' size='21' style=font-size:12px;background-color:white;border-width:1;border-color:rgb(153,153,153); border-style:solid;height:18;margin:1; type=submit> <input type='submit' value='확인' style=width:50;font-size:12px;background-color:white;border-width:1;border-color:rgb(153,153,153); border-style:solid;height:18;margin:1; type=submit></p>
                        </td>
                </tr>

                <tr>
                        <td height=50></td>
                </tr></table>
        </td>
        </tr></form>
        </table>
        <script>document.password.password.focus(); </script>";
        exit;
}
// 여기까지 로그인

echo"<a href='$_SERVER[PHP_SELF]?action=logout'>로그아웃</a><br>여기에서부터 내용을 밑으로 쭈욱 코딩하시면 됩니다....";

?>
제목 글쓴이 날짜
[PHP 동영상강의] 43. 공용함수의 제작/쿠키로그인(보안) [4] 서기 2006.03.16
[PHP 동영상강의] 39. 회원가입/로그인 처리 [8] 서기 2006.02.06
[PHP 동영상강의] 25. 회원가입처리 / 로그인 구현 [6] 서기 2005.12.16
효율적인 경로 지정하기 [9] 대류 2005.07.27
나만의 미니홈 만들기 ㅡ password.php [8] file 예뜨락 2005.05.07
나만의 미니홈 만들기 ㅡ delete.php 파일 [2] 예뜨락 2005.01.03
IE 에서도 투명 알파값이 적용된 PNG 이미지를 맘껏 활용하자! [8] file THE PAPER™ 2004.12.27
나만의 미니홈 만들기 ㅡ view.php 파일과 제목링크 [9] file 예뜨락 2004.11.27
나만의 미니홈 만들기 ㅡ list.php , 디비 테이블 생성 [6] file 예뜨락 2004.11.26
나만의 미니홈 만들기 ㅡ 미니홈 생성 페이지 [3] file 예뜨락 2004.11.20
나만의 미니홈 만들기 ㅡ 기초적인 관리 페이지 [3] file 예뜨락 2004.11.20
나만의 미니홈 만들기 ㅡ 메인 기초 설계3 .레이아웃 [2] file 예뜨락 2004.11.19
나만의 미니홈 만들기 ㅡ 글쓰기에 앞서... [1] 예뜨락 2004.11.17
PHP프로그램에 간단한 인증(로그인) 걸기. [15] Lepas 2004.08.09
히어닥 문법 활용 [14] ☺심심 2004.07.13
해당 ftp 파일 서버에서 다른곳의 ftp 파일 서버로 백업용도 및 전송하기.. [9] 김동욱 2004.05.30
제로카운터 쉽게 설치하기 [26] file 대류 2004.01.17
세션을 이용한 관리자 모드 구축하기 3강 [6] 박정호 2003.12.09
세션을 이용한 관리자 모드 구축하기 2강 [6] 박정호 2003.12.09
세션을 이용한 관리자 모드 구축하기 1강(중복?) 박정호 2003.12.09