Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1.     public static boolean RequestIPBAuth(String host, String file, String user, String password, StringBuilder group)
  2.     {
  3.        
  4.         try
  5.         {
  6.             URL url = new URL(host + "/" + file + "?user=" + user + "&pass=" + password);
  7.             URLConnection connection = url.openConnection();
  8.             BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  9.             StringBuffer buffer = new StringBuffer();
  10.            
  11.             String currentLine;
  12.            
  13.             while((currentLine = reader.readLine()) != null)
  14.             {
  15.                 buffer.append(currentLine);
  16.             }
  17.            
  18.             String retData = buffer.toString();
  19.             String[] args = new String[2];
  20.             args[0] = retData.substring(retData.indexOf("r:")+2, retData.indexOf("|"));
  21.             args[1] = retData.substring(retData.indexOf("p:") + 2);
  22.            
  23.             if (args[0].equals("") || args[1].equals("Banned") || args[1].equals("Failed"))
  24.                 return false;
  25.            
  26.             group.append(args[1]);
  27.            
  28.         }
  29.         catch (Exception e)
  30.         {
  31.             e.printStackTrace();
  32.         }
  33.        
  34.         return false;
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement