<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<title>欢迎光临<%=title%></title>
<link rel="stylesheet" href="../css/css.css" type="text/css" media="screen">
</head>
<body>
<%
String loginerror = null;
String userName = request.getParameter("username");
String passWord = request.getParameter("password");
%>
	<TABLE bgColor=<%=tablebgcolor%> border=0 cellPadding=0 cellSpacing=1 width=400 align=CENTER>
	<TR><TD align=middle background=img/index/topback.gif height=10></TD></TR>
	</TABLE>
<%
if("".equals(userName)) {
	loginerror = "请输入您的用户名!";
}
if("".equals(passWord)) {
	loginerror = "请输入您的密码!";
}
try{	
	DispMaster dispmaster = new DispMaster();
	dispmaster.setUserName(userName);
	dispmaster.setUserPassword(passWord);
	if(!dispmaster.chkLogin()){
		loginerror = "用户名或密码错误！请重新登陆。";
%>

	<TABLE border="0" width=400 align=center cellpadding=0 cellspacing=1  bgcolor=<%=tablebgcolor%>>
	<TR bgcolor=<%=trbgcolor%> height=25><TD align=center><FONT COLOR=red><B>错误</B></FONT></TD></TR>
	<TR><TD align=center bgColor=<%=tdbgcolor%>><BR><%=loginerror%><BR><A href="javascript:onclick=history.back()">[返回上页]</A></TD></TR>
	</TABLE>
<%}
	else{
	String userName_s = null;
	String passWord_s = null;
	session.setAttribute("userName_s",userName);
	session.setAttribute("passWord_s",passWord);
	MasterControl mastercontrol = new MasterControl();
	mastercontrol.setUserName(userName);
	mastercontrol.addloginnum();
	response.sendRedirect("main.jsp");
	}
}
catch(Exception e){
	System.out.println("错误信息:"+e.getMessage());
	}
%>