?? check.jsp
字號:
<%@include file="connect_odbc.jsp"%>
<%@page contentType="text/html; charset=gb2312"%>
<html>
<body bgcolor="#009999">
<head>
<title>
校驗用戶信息
</title>
</head>
<%
String userid,username="";
String pass,err="";
boolean sr=true;
userid=(String)request.getParameter("user");
pass=(String)request.getParameter("pass").trim();
if (userid.length()==0||userid==null)
{
sr=false;
err="對不起,用戶名必須輸入,請重試!";
}
if(sr)
{
userid=userid.trim();
if(pass==null)
{
pass="";
}
sql="SELECT KSDM,KSMC,YHKL FROM YY_KSDM WHERE KSDM="+userid+" AND (XZFS>0 OR XZFS_WC>0)";
try{
rs=stmt.executeQuery(sql);
}
catch(SQLException RE){
err="對不起,查詢數據庫失敗,請重試!"+RE.getMessage();
//response.sendRedirect("index.jsp?errmsg=對不起,查詢數據庫失敗,請重試!");//網頁重定向
}
int i=0;
String pass_new="";
// out.println(sql);
//con.
while(rs.next())
{
userid=rs.getString(1);
username=rs.getString(2);
pass_new=rs.getString(3).trim();
i++;
}
if(i==0)
{
err="對不起,沒有此用戶,請重試!";
//response.sendRedirect("index.jsp?errmsg=對不起,沒有此用戶,請重試!");//網頁重定向
}
else
{
if(pass_new==null)
{
pass_new="";
}
if(pass_new.equals(pass))
{
// out.println(username);
request.getSession(true);//建立使用者的session
session.setAttribute("ksdm",userid);
session.setAttribute("ksmc",username);
pool.releaseConnection(con);
response.sendRedirect("main.jsp");//網頁重定向
}
else
{
err="對不起,密碼錯誤,請重試!";
//response.sendRedirect("index.jsp?errmsg=對不起,密碼錯誤,請重試!");//網頁重定向
}
}
}
pool.releaseConnection(con);
%>
<BR><BR><BR>
<FONT face="宋體" SIZE="5" COLOR=""><CENTER><%=err%></CENTER></FONT>
<BR>
<CENTER><a href="javascript:history.back();"><FONT face="宋體" SIZE="5" COLOR="">返回</FONT></a></CENTER>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -