SHARE
TWEET

Untitled

a guest May 22nd, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public boolean login(String username, String password) {
  2.         boolean loggedin = false;
  3.         try {
  4.             String urltext = getCodeBase()+"login.php";//?user=" + username + "&pass=" + password;
  5.             URL url = new URL(urltext);
  6.             BufferedReader in = null;
  7.             in = new BufferedReader(new InputStreamReader(url.openStream()));
  8.             String result;
  9.  
  10.             result = in.readLine();
  11.             if(result == "true") {
  12.                 System.out.println("Login Successful!");
  13.                 loggedin = true;
  14.             }
  15.             else {
  16.                 System.out.println("Login Denied!");
  17.             }
  18.             System.out.println("Returned: \""+result+"\"");
  19.             in.close();
  20.         }
  21.         catch(Exception e) {
  22.             System.out.println("Error: "+e);
  23.         }
  24.         return loggedin;
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top