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

📄 logchk.jsp

📁 基于JSP的网上花店系统。工作量符合本科毕业设计水准1
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>淳.清凉花坊</title>
<meta name="keywords" content="淳.清凉花坊">
<meta name="description" content="淳.清凉花坊">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</link>
</head>
<body bgcolor="#FFFFFF">
<%! public String getString(String s)
   {if(s==null) s="";
   try {byte a[]=s.getBytes("ISO-8859-1");
          s=new String(a);
		  }
		  catch(Exception e)
		  {}
		  return s;
		  } %>
  <%
   String userid=request.getParameter("userid");
     userid=getString(userid);
	   if(userid==null)
            {userid="";}
     
     String password=request.getParameter("password");
    password=getString(password);
	if(password==null)
            {password=""; }
	
  String r1=request.getParameter("Submit");
    r1=getString(r1);
	if(r1==null)
            {r1=""; }
	
  Connection con=null;
  Statement sql=null;
  ResultSet rs=null;
      try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); }
      catch(ClassNotFoundException event) { }
  try { 
        con=DriverManager.getConnection("jdbc:odbc:sun","sa","");
        sql=con.createStatement();
        String condition=
		"select * from uuser where userid='"+userid+"' and password='"+password+"'";
       rs =sql.executeQuery(condition);
    if (!rs.next())
         
    	{
	 %><script LANGUAGE="javascript">
		  alert("对不起,用户名或密码错误!");
		  history.go(-1);
		  </script>
      <% 
	   }
	  else {
	         String nn=rs.getString("userid");
	        String jj=rs.getString("password");
	         session.setAttribute("userid",nn);
	        session.setAttribute("password",jj);
	         int kk=rs.getInt("vip_class");
	         session.putValue("userid",userid);
	        if(kk==-1) {
	     
	            response.sendRedirect("admin_log.jsp");
	              }
	        else 
	        {response.sendRedirect("index.jsp");
		   }
	  
	  }
          con.close();
      }
   catch(SQLException e) { }


		%>
</body>
</html>

⌨️ 快捷键说明

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