admincheck.java

来自「ssh2整合.一个登陆页面,jdk5,tomcat5.5,hibernate3.」· Java 代码 · 共 24 行

JAVA
24
字号
package com.jxsme.gov.user;

import java.sql.SQLException;


public class adminCheck {
	public boolean admin(String username,String password){
		com.jxsme.gov.dao.db db= new com.jxsme.gov.dao.db();
		java.sql.ResultSet rs=db.executeQuery("select id from user where user_id='"+username+"'  and password ='"+password+"'");
		try {
			while(rs.next()){
				System.out.println(("user:"+username+"login:ok"));
				db.executeUpdate("update user  set lastInTime=now()  where id="+rs.getString("id"));
				return true;
			}
			return false;
		} catch (SQLException e) {
			System.out.println("com.jxsme.gov.user.admincheck method admin:"+e);
           return false;
		}
	}

}

⌨️ 快捷键说明

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