쿠키 로그인여부
<%@ page contentType="text/html; charset=EUC-KR" %>
<html>
<head>
<TITLE>로그인 확인 화면</TITLE>
</head>
<body>
<%
Cookie[] cookies = request.getCookies();
boolean isLogin = false;
if(cookies != null && cookies.length > 0)
for(int i = 0;i < cookies.length;i++) {
String cookie_name = cookies[i].getName();
String cookie_value = cookies[i].getValue();
if(cookie_name.equals("ID") && cookie_value.equals("ADMIN")) {
isLogin = true;
break;
}
}
if(isLogin) {
out.print("<h2>로그인 한 상태입니다.</h2>");
out.print("<h3><a href=8-11.jsp>로그아웃</a></h3>");
}
else {
out.print("<h2>로그인 안한 상태입니다.</h2>");
out.print("<h3><a href=8-8.jsp>로그인</a></h3>");
}
%>
</body>
</html>