Guest User

Untitled

a guest
Mar 7th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /**
  2.  * Sign in as the specified user within this session.
  3.  *
  4.  * @author Overv
  5.  *
  6.  * @param username Username to sign in with.
  7.  * @param password Associated passsword.
  8.  * @param callback Function to pass the result to.
  9.  */
  10. public void login( String username, String password, final LoginCallback callback )
  11. {
  12.     this.username = username;
  13.     String pwdHash = MD5( password );
  14.    
  15.     asyncWebRequest( "login.php?do=login", "do=login&cookieuser=1&vb_login_username=" + username + "&vb_login_md5password=" + pwdHash, new WebRequestCallback()
  16.     {
  17.         public void onResult( String source, String cookies )
  18.         {
  19.             if ( source != null && cookies.contains( "bb_password" ) )
  20.             {
  21.                 bb_userid = Integer.parseInt( quickMatch( "bb_userid=([0-9]+)", cookies ) );
  22.                 bb_password = quickMatch( "bb_password=([a-zA-Z0-9]+)", cookies );
  23.                
  24.                 callback.onResult( true );
  25.             } else {
  26.                 callback.onResult( false );
  27.             }
  28.         }
  29.     } );
  30. }
Add Comment
Please, Sign In to add comment