⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.jsp

📁 现今的社会是一个信息飞速发达的社会
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="con" scope="page" class="numb1.com.db"/>
<jsp:useBean id="ht" scope="page" class="numb1.com.Dohtml"/>
<jsp:useBean id="onLine" scope="application" class="numb1.com.onLine"/>
<%@ include file = "include/config.jsp" %>
<%
String p=request.getParameter("page");p=ht.donull(p);
String bdid=request.getParameter("bdid");bdid=ht.donull(bdid);
String bbsid=request.getParameter("bbsid");bbsid=ht.donull(bbsid);
String name="";
String root="";
String sendredir="first.jsp";
String sql;
ResultSet rs;

if(p.indexOf("display")!=-1){
sendredir=p+".jsp?bdid="+bdid+"&bbsid="+bbsid;
}else if(p.indexOf("main")!=-1){
sendredir=p+".jsp?id="+bdid;
} 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
<!--
td{font-size:12px}
td{font-size:15px}
.style1 {color: #FFFFFF}
a:link{text-decoration:none;color:#0000ff}
a:visited{text-decoration:none;color:#0000ff}
a:hover{text-decoration:underline;color:#96CCFE}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
function check_form(theform)
	{
		if (theform.id.value=="")
		{
			alert("请输入您的ID!");
			theform.id.focus();
			return false;
		}
		if (theform.pw.value=="")
		{
			alert("请输入您的密码!");
			theform.pw.focus();
			return false;
		}
			}

</script>
</head>

<body><br>
<br>
<br>
<%
String id=(String)request.getParameter("id");id=ht.donull(id);
String mm=(String)request.getParameter("pw");mm=ht.donull(mm);

boolean test;
if(id.compareTo("")!=0 && mm.compareTo("")!=0){

if(online_enable == "on"){
test=onLine.Login(id,request.getRemoteAddr());
}else{
test=true;
}

if(test){
sql="select*from numb1 where userid='"+id+"' and pw='"+mm+"'";
rs=con.query(sql);rs.next();if(rs.getRow()!=0){
session.setAttribute("id",id);

sql="select step, name from user where userid='"+id+"'";
rs=con.query(sql);rs.next();
if(rs.getRow()!=0){
root=rs.getString(1);
name=con.getStr(rs.getString(2));
session.setAttribute("root",root);
session.setAttribute("name",name);
}

sql="select ontims from online where userid='"+id+"'";
rs=con.query(sql);rs.next();
int count=rs.getInt(1)+1;

String ip=request.getRemoteAddr();
sql="update online set ontims="+count+",lastip='"+ip+"',lastim=now() where userid='"+id+"'";
con.update(sql);

response.sendRedirect(sendredir);
}else{
out.print("<table width=\"640\" border=\"0\" align=\"center\"><tr><td><p align=\"center\"><font color=\"#FF0000\">对不起!您的密码或用户ID输入有误,请核实后正确输入。如果您还没<a href=\"reg.jsp\">注册</a>,点击<a href=\"reg.jsp\">此处注册</a>请点击<a href=\"login.jsp\">此处返回</a>登录页面,如果您忘记密码,请点击此处去回密码!</font></p></td></tr></table><meta http-equiv=\"refresh\" content=\"3;URL=login.jsp\">");
}
}else{
out.print("<table width=\"640\" border=\"0\" align=\"center\"><tr><td><p align=\"center\"><font color=\"#FF0000\">对不起!您的ID已经有人在使用,如果您是由于您没有正常注销的话,请您在"+onTime_m+"分钟后重新登录。点击<a href=\"login.jsp\">此处返回</a>登录页面。</font></p></td></tr></table><meta http-equiv=\"refresh\" content=\"20;URL=login.jsp\">");
}
}else{
%>
<form name="form1" method="post" action="login.jsp" onSubmit="return check_form(this)">
<table width="300"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#738AD1">
  <tr>
    <td bgcolor="#f8f8f8"><table width="100%"  border="0" cellpadding="0" cellspacing="1">
      <tr>
        <th height="20" bgcolor="#738AD1"><span class="style1">用 户 登 录</span></th>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#f8f8f8"><table width="99%"  border="0" align="center">
      <tr>
        <td height="8" colspan="2"></td>
      </tr>
      <tr>
        <td width="30%"><div align="right">ID:</div></td>
        <td width="70%"><input name="id" type="text" id="id" size="20"style="BORDER: #7188e0 1px solid;color:#1818FF;">
        </td>
      </tr>
      <tr>
        <td><div align="right">密码:</div></td>
        <td><input name="pw" type="password" id="pw" size="21"style="BORDER: #7188e0 1px solid;color:#1818FF;"></td>
      </tr>
      <tr>
        <th colspan="2"><input name="imageField" type="image" src="img/enter1.gif" width="60" height="22" border="0" onmouseout="this.src='img/enter1.gif'" onMouseOver="this.src='img/enter2.gif'">&nbsp;
          <input name="right" type="hidden" id="right" value="n">
            <a href="reg.jsp"><img src="img/app1.gif" width="60" height="22" border="0" onmouseout="this.src='img/app1.gif'" onMouseOver="this.src='img/app2.gif'"></a>
            <input name="page" type="hidden" id="page" value="<%=p%>">
            <input name="bdid" type="hidden" id="bdid" value="<%=bdid%>">
            <input name="bbsid" type="hidden" id="bbsid" value="<%=bbsid%>"></th>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<% 
}
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -