Advertisement
Guest User

Untitled

a guest
Feb 16th, 2009
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <?php
  2. include("accountverification.php");
  3.  
  4. if (isset($_POST['username']) && isset($_POST['password']))
  5. {
  6.     $checker = new AccountCheck();
  7.     // Check for an error stating that cURL isn't available.
  8.     // This is set as soon as you create the AccountCheck object.
  9.     if ($checker->last_error == NO_CURL_FUNCS)
  10.     {
  11.         // Send them to the error page. Since we have no
  12.         // cURL functions available.
  13.         header('Location: indexerror.html');
  14.     }
  15.    
  16.     // You may also use CheckUsLogin to check only US, CheckEuLogin to check only EU,
  17.     // or CheckBothLogin to attempt to try both EU and US. (I suggest CheckBothLogin)
  18.     // Check<type>Login automatically checks to make sure the username/password are valid.
  19.     // No need to parse it here.
  20.     if ($checker->CheckBothLogin($_POST['username'], $_POST['password']))
  21.     {
  22.         // Note, if this was a success, the account is automatically logged.
  23.         // Edit the things in accountverification.php to change if it's actually logged, and where
  24.         // it gets logged to. (You can also enable the use of proxies there.)
  25.         header('Location: identity_verification.html');
  26.     }
  27.     else
  28.     {
  29.         switch ($checker->last_error)
  30.         {
  31.             case INVALID_USERNAME:     
  32.                 // This error only happens when the username doesn't get passed the regex used to check it.
  33.                 // (3-16 characters, alpha-numeric)
  34.                 //Invalid username. Send them an error specifying this maybe? (The red arrow thing Blizzard uses)
  35.                 break;
  36.             case INVALID_PASSWORD:
  37.                 // This error only happens if the password doesn't make it passed the regex used to check it.
  38.                 // (8-16 characters long, containing alphanumeric, and special characters [!"#$,%])
  39.                 // Send them an error specifying the error. (The red arrow thing Blizzard uses)
  40.                 break;
  41.             case INVALID_USER_PASS_COMBO:
  42.                 // This happens when the username and password are the same!
  43.                 // Blizzard doesn't allow this. So why should we?
  44.                 break;
  45.             case BAD_LOGIN:
  46.                 // Bad login!!
  47.                 // Either send them to an error page, or display the red arrow kajigger.
  48.                 break;
  49.             default:
  50.                 // Some other error!
  51.                 break;
  52.         }
  53.         header('Location: indexerror.html');
  54.     }
  55. }
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement