Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- AccountCheckEngine.php coded by Apoc@MMOwned.com & Apoc@ApocDev.com
- */
- define(US_LOGIN_URL, 'https://www.blizzard.com/login/login.xml?referer=https%3A%2F%2Fwww.worldofwarcraft.com%2Faccount%2F&loginType=wow');
- define(EU_LOGIN_URL, 'https://eu.blizzard.com/login/login.xml?loginType=wow&referer=https%3A%2F%2Fwww.wow-europe.com%2Faccount%2F');
- /* Checks to make sure the web host even supports cURL. */
- function checkBasicCURLFunctions()
- {
- if(!function_exists("curl_init") || !function_exists("curl_setopt") || !function_exists("curl_exec") || !function_exists("curl_close"))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- /* Checks the specified password to see if it's valid or not */
- function CheckValidPassword($password)
- {
- if (strlen($password) >= 8 && strlen($password) <=16)
- {
- // Return if there were no matches.
- return preg_match('/^(?=.*\d)(?=.*[a-zA-Z])(?!.*[^\w!"#$,%]).{8,16}$/', $password) == 0;
- }
- return false;
- }
- /* Checks the specified username to see if it's valid or not */
- function CheckValidUsername($username)
- {
- if (strlen($username) >= 3 && strlen($username) <=16)
- {
- // Return if there were no matches.
- return preg_match('/^\w{3,16}$/', $username) == 0;
- }
- return false;
- }
- /* Checks the specified username and password to see if they're valid or not */
- function CheckValidAccount($username, $password)
- {
- // Checks all the WoW specific account verifications prior to web based login.
- if ($username != $password)
- {
- return CheckValidUsername($username) && CheckValidPassword($password);
- }
- return false;
- }
- /* Runs the actual login process */
- function _Login($username, $password, $url)
- {
- if (!CheckValidAccount($username, $password))
- {
- // Not a valid account. Don't bother going any further!
- return "FAIL: Username/password is not allowed!";
- }
- if (!checkBasicCURLFunctions)
- {
- return "FAIL: cURL not available!";
- }
- $postvars = "accountName=$username&password=$password";
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_POST, 1); // Sending a POST request
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); // Setup the POST variables
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Just go along with any redirects
- curl_setopt($ch, CURLOPT_HEADER, 0); // We don't want to return any HTTP headers
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // And we want the return contents, instead of a bool value.
- $returnedPage = curl_exec($ch); // Get our stuff!
- curl_close($ch);
- if (strstr($returnedPage, "Invalid account name or password"))
- {
- return "FAIL: Invalid account name or password";
- }
- else
- {
- return "SUCCESS";
- }
- }
- /* Attempts to login to the US account management website
- Returns: SUCCESS on login, a fail message otherwise.
- */
- function CheckUsLogin($username, $password)
- {
- return _Login($username, $password, US_LOGIN_URL);
- }
- /* Attempts to login to the EU account management website
- Returns: SUCCESS on login, a fail message otherwise.
- */
- function CheckEuLogin($username, $password)
- {
- return _Login($username, $password, EU_LOGIN_URL);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement