ClassicASP 세션 로그인 / 로그아웃 후 Redirect 하기
페이지 정보
본문
###### 로그인 login.asp
방법1>
<%
if session("user_id") = "아이디" then
response.Redirect "/admin/main.asp"
response.end
end if
%>
<!--#include virtual="/inc/_happyjung_.asp" -->
<title>로그인</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script type="text/javascript">
function fncsubmit(form){
if (form.pwd.value == ""){
alert("관리자암호를 입력해 주세요")
form.pwd.focus()
return;
}
if (form.id.value == ""){
alert("관리자아이디를 입력해주세요")
form.id.focus()
return;
}
form.submit()
}
</script>
</head>
<body>
<br><br>
<div align="center">
<form name="frm_admin" method="post" action="login_ok.asp" style="margin:0; padding:0">
<table width="224" border="2" cellpadding="0" cellspacing="0" bordercolor="#E4E4E4">
<tr>
<td height="126" valign="top"><table width="219" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="43" valign="top"><img src="/image/titles.gif" alt="로그인" /></td>
</tr>
<tr>
<td height="116" align="center"><table width="318" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="109">관리자아이디</td>
<td height="23"><input name="id" type="text" size="25" maxlength="12" /></td>
</tr>
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td class="style7">관리자비밀번호</td>
<td><input name="pwd" type="password" size="25" maxlength="12" /></td>
</tr>
<tr align="center">
<td height="35" colspan="2"><input name="button" type="button" onclick="javascript:fncsubmit(frm_admin)" value="입력완료" />
<input name="reset" type="reset" onclick="javascript:history.back (-1)" value="취소하기" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</div>
</body>
</html>
###### 로그인 login_ok.asp
<%
id = request("id")
pwd = request("pwd")
admin_id = "아이디"
admin_pwd = "비밀번호"
If id <> admin_id then
response.write "<script type='text/javascript'>alert('아이디가 틀립니다.');history.go(-1);</script>" else
If pwd <> admin_pwd then
response.write "<script type='text/javascript'>alert('패스워드가 틀립니다.');history.go(-1);</script>"
else
session("user_id") = "아이디"
response.Redirect "admin/main.asp"
response.end
end if
end if
%>
###### 로그아웃 logout.asp
<script type="text/javascript">
<!--
var login_off
login_off=confirm("로그아웃 하시겠습니까? ");
if (login_off!==true) {
history.back();
}
else {
<%
session.Abandon
Response.Redirect "/main/index.asp"
%>
}
//-->
</script>
###### 세션 체크 login_session.asp
<%
'response.write "session[" & session("admin") & "]<br>"
if IsEmpty(session("member")) then
'if session("user_id") = "" then
response.Redirect "../"
response.end
end if
%>
댓글목록
등록된 댓글이 없습니다.