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

📄 authorize.java

📁 JAVA编程思想源代码 值得一下 很难找的
💻 JAVA
字号:
package chapter10.util;

import java.sql.*;

import chapter10.util.DBManager;

/**
 * @author panglina
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Authorize {
	
	private  Statement stat;
	private ResultSet res;
	String quote="\"";
	
	public  boolean isAuth(String username,String password)
	{
		boolean isAuth=false;
		
		DBManager dbM=new DBManager();
		stat=dbM.getStatement();
		String sqlString="select password from auth where username="+quote+username+quote;
		
		try {
			res=stat.executeQuery(sqlString);
			while (res.next())
			{
				if(password.equals(res.getString(1)))
					isAuth=true;
				}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return isAuth;
		
	}

	public static void main(String[] args) {
		
		Authorize auth=new Authorize();
		boolean is=auth.isAuth("panglina","panglina");
		System.out.println(is);
		
	}
}

⌨️ 快捷键说明

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