웹개발 - PHP 프로그램 개발 강의
글수 707
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>여기에서부터 내용을 밑으로 쭈욱 코딩하시면 됩니다....";
?>
2004.08.12 18:01:33 (*.223.141.207)
비밀번호를 어떻게 빼내는지 가르쳐주실래요?
crypt 복호화 함수도 있나요? 아니면... PHP 소스를 그대로 읽는 방법이라도 있나요??
crypt 복호화 함수도 있나요? 아니면... PHP 소스를 그대로 읽는 방법이라도 있나요??
2004.08.12 19:29:36 (*.36.241.139)
테이블을 나모로 작성하셨나보네요. ㅎㅎ
나모가 테이블 만들때 편하긴하죠.. 지맘대로 수정하거나 rgb(153,153,153) 이런식의 코드로 내놓지만 않으면..
나모가 테이블 만들때 편하긴하죠.. 지맘대로 수정하거나 rgb(153,153,153) 이런식의 코드로 내놓지만 않으면..
2004.08.28 00:19:13 (*.48.228.116)
외부에서 PHP를 볼 수 있는 사람은 세상에 아무~도 없습니다. 계정을 직접 해킹하지 않는 한... (아마 서버관리자는 볼 수 있겠죠 ;ㅁ;)
2004.08.17 00:03:47 (*.223.23.103)
정재호// 님이 말씀하신건 그 계정 내에서만 가능하구요... 타 계정에서는 http:// 로결과물만 불러오기 때문에 변수자체를 만질수는 없습니다.



저같은 경우는 키 값을 DB에 저장하는데요 이 때 DB 가 이값을 암호화를 시켜서 저장해
놓기 때문에 해킹염려가 많이 적어져요 저는 이방법을 많이 사용한답니다^^
암호학 공부한지도 꽤 됐는데 여태 PHP암호화 스크립트 하나 안 짜봤다는-_-...
- 암호학 학도인 php 매니아