웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
PHP프로그램에 간단한 인증(로그인) 걸기.
2004.08.09 17:43
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>여기에서부터 내용을 밑으로 쭈욱 코딩하시면 됩니다....";
?>
그나마 보안에 신경쓰자면 패스워드를 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>여기에서부터 내용을 밑으로 쭈욱 코딩하시면 됩니다....";
?>
댓글 15
-
양영직
2004.08.09 19:05
-
Lepas
2004.08.12 18:01
비밀번호를 어떻게 빼내는지 가르쳐주실래요?
crypt 복호화 함수도 있나요? 아니면... PHP 소스를 그대로 읽는 방법이라도 있나요?? -
Simsim
2004.08.12 19:27
하하 양영직님 설명좀 해주시죠. -
Simsim
2004.08.12 19:29
테이블을 나모로 작성하셨나보네요. ㅎㅎ
나모가 테이블 만들때 편하긴하죠.. 지맘대로 수정하거나 rgb(153,153,153) 이런식의 코드로 내놓지만 않으면.. -
츠즈키
2004.08.14 11:35
모르겠다는..ㅠㅠ흑~ -
정재호
2004.08.16 20:33
<? include "파일이름" ?>
<?=$admin_pass ?>
안되려나..;; -
EDENe
2004.08.28 00:19
외부에서 PHP를 볼 수 있는 사람은 세상에 아무~도 없습니다. 계정을 직접 해킹하지 않는 한... (아마 서버관리자는 볼 수 있겠죠 ;ㅁ;) -
Simsim
2004.08.31 00:50
푸흠.. 양영직님 개념 확립 -
Lepas
2004.08.17 00:03
정재호// 님이 말씀하신건 그 계정 내에서만 가능하구요... 타 계정에서는 http:// 로결과물만 불러오기 때문에 변수자체를 만질수는 없습니다. -
RealLove
2004.08.12 15:43
비밀번호 누출되지 않을까.. 염려.. -
양영직
2004.08.22 17:34
다만 저 프로그램을 다운로드 방지 등등을 해놓으면 약간의 해결책이 될수도... -
양영직
2004.08.22 17:34
simsim 님 어떤 설명을? -
Pe-i
2004.08.24 14:39
양영직//외부에서 다운로드가 된다 하더라도 php코드는 안보입니다. -
초코
2005.09.22 18:58
자기가 해커라고 깝치는놈들치고 개풀도 모름 -
현태풍
2007.01.09 14:25
//정재호
<? include "파일이름" ?>
<?=$admin_pass ?> --> 요변수명은 어디서 알아내는지가 더궁금하네요..
변수명을 미리알고 있지 않다면 불가능하죠.. 소스를 보셨으니까 아셨겠죠..ㅋ
인클루드하면 보이나요?? 변수명은 모를텐데.. 소스를 보지 않는이상은..;;
제목 | 글쓴이 | 날짜 |
---|---|---|
특정 확장변수를 로그인한 회원에게만 보이게 하기 [3] | 비밀얌 | 2011.09.17 |
로그인 위젯 질문드립니다. | 소리없는 | 2011.08.31 |
비로그인시 본문대신 지정문구 보이기 [1] | 도라란 | 2011.07.11 |
1.4.5 업데이트후 로그인 안되시는 분들 [3] | BlogJh | 2011.04.03 |
동일서버내 페이지에서 로그인정보 활용하기... [4] | 수로 | 2008.09.06 |
XE공식레이아웃(xe_official_v2)에서 소셜XE로그인창 연동 | ehdgkr97 | 2011.02.13 |
외부로그인을 어떻게 생성 하나요? [3] | 엄경선 | 2011.02.08 |
'대표도메인'연결후 '로그인'이 안될때,,(먹통) | moonlight994 | 2011.01.24 |
로그인 폼에 관리자는 [Admin] 나타나게 하기 [4] | 오스카 | 2009.10.10 |
IIS에서 아웃로그인,최근게시물이 htm,html 에선 안돼고 php에서만 될때 해결방법 [4] | kyjzz | 2004.07.01 |
iis에서 로그인창 뜨는 문제 해결방법 제시 [3] | 함재식 | 2003.12.12 |
FTP 에 사용자추가후 로그인부분 추가하기 - 로그인 부분 [2] | DearMai | 2002.08.12 |
FTP 에 사용자추가후 로그인부분 추가하기 - 사용자추가부분 [5] | DearMai | 2002.08.12 |
포인트부여시 ...회원로그인 [2] | 구본순 | 2007.08.28 |
[PHP 동영상강의] 43. 공용함수의 제작/쿠키로그인(보안) [4] | 서기 | 2006.03.16 |
[PHP 동영상강의] 39. 회원가입/로그인 처리 [8] | 서기 | 2006.02.06 |
[PHP 동영상강의] 25. 회원가입처리 / 로그인 구현 [6] | 서기 | 2005.12.16 |
PHP프로그램에 간단한 인증(로그인) 걸기. [15] | Lepas | 2004.08.09 |
한꼬마의 제로보드 활용방법 (로그인 값 알아 보기) [3] | 한꼬마 | 2003.11.20 |
웹 인증 보호, 윈도우 로그인 폼 이용 (authenticate) [9] | 둘리나라™ | 2003.01.13 |
저같은 경우는 키 값을 DB에 저장하는데요 이 때 DB 가 이값을 암호화를 시켜서 저장해
놓기 때문에 해킹염려가 많이 적어져요 저는 이방법을 많이 사용한답니다^^
암호학 공부한지도 꽤 됐는데 여태 PHP암호화 스크립트 하나 안 짜봤다는-_-...
- 암호학 학도인 php 매니아