public int validateUser(String name, String unhashedPassword){
		
		String query = String.format("SELECT * FROM %s WHERE username='%s' AND password=(MD5('%s'));",
				this.getTable(), name, unhashedPassword);
		int rows = -1;
		try {
			rows = super.getRowCount(query.replace("*", "COUNT(*)"));
		} catch (SQLException e1) {
			QueryLogger.getInstance().logError("user, validateUser()/rowCount()");
		}
		
		ResultSet rs = this.executeQuery(query);
		
		if(rows > 0) return 0;
		
		String username = null;
		String password = null;
		User user = null;
		int result = 1;

		query = String.format("SELECT * FROM %s WHERE username='%s';",
				this.getTable(), name);
		rs = this.executeQuery(query);
		
		try {
			while(rs != null && rs.next()){
				for(int i = 1 ; i <= rs.getMetaData().getColumnCount(); i++){
					String data = rs.getObject(i).toString();
					switch (i){
						case 3: password = data; break;
						case 2: username = data; break;
					}
				}
			}
		} catch (SQLException e) {
			QueryLogger.getInstance().logError("user, validateUser()");
		}
		
		if(username != null){
			user = new User(-1, username, password);
			String hash = Security.md5(unhashedPassword);
			
			result = 2;
		}
		
		return result;
	}