public static function GetResetStatus($JSONP) { $WorldStates = [20001, 20002, 20003, 20006, 20007]; $Response = []; $Statement = parent::$CharConnection->prepare('SELECT * from worldstates WHERE entry IN(20001, 20002, 20003, 20006, 20007);'); $Statement->execute(); $Result = $Statement->fetchAll(PDO::FETCH_ASSOC); if (Database::IsEmpty($Statement)) { foreach ($WorldStates as $ID) { $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => '0']; } } else { foreach ($Result as $WS) { foreach ($WorldStates as $ID) { if ($ID == $WS['entry']) { $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => $WS['value']]; break; } else { $Response[] = [ArmoryAPI::GetWorldstateByID($WS['entry']) => '0']; break; } } } } return parent::Encode($Response, $JSONP, "wsrt"); }
public static function getMedia($TypeID) { $Statement = Media::$DBConnection->prepare('SELECT * FROM media WHERE type = :typeid'); $Statement->bindParam(':typeid', $TypeID); $Statement->execute(); if (Database::IsEmpty($Statement)) { return false; } else { $Result = $Statement->fetchAll(PDO::FETCH_ASSOC); return ['count' => count($Result), 'items' => $Result, 'data' => Media::getMediaTypeByID($TypeID)]; } }
public static function GetItem($ItemID) { $Statement = Shop::$DBConnection->prepare('SELECT si.*, p.price FROM shop_items si LEFT JOIN prices p ON si.id = p.id WHERE si.id = :itemid'); $Statement->bindParam(':itemid', $ItemID); $Statement->execute(); $Result = $Statement->fetch(PDO::FETCH_ASSOC); if (Database::IsEmpty($Statement)) { return false; } else { $Result['category'] = Shop::GetCategoryByID($Result['item_type']); $Result['backgrounds'] = Shop::AvailableBackgrounds(); return $Result; } }
private static function VerifyAndroidArmoryKeyExistance($Username, $Password) { $StringToHash = $Username . ':' . $Password; $HashedPassword = Account::HashPassword('sha1', $StringToHash); $Statement = parent::$DBConnection->prepare('SELECT armory_key FROM api_android_armory WHERE username = :username AND password = :password'); $Statement->bindParam(':username', $Username); $Statement->bindParam(':password', $HashedPassword); $Statement->execute(); $Result = $Statement->fetch(PDO::FETCH_ASSOC); if (Database::IsEmpty($Statement)) { return false; } else { return $Result['armory_key']; } }
public static function GetCharactersDeletedItems($CharacterGUID) { $Statement = parent::$CConnection->prepare('SELECT * FROM item_restoration WHERE character_guid = :guid'); $Statement->bindParam(':guid', $CharacterGUID); $Statement->execute(); if (Database::IsEmpty($Statement)) { return false; } else { $Index = 0; $Result = $Statement->fetchAll(PDO::FETCH_ASSOC); foreach ($Result as $Item) { $Result[$Index]['price'] = Text::MoneyToCoins($Item['item_price']); $Result[$Index]['data'] = parent::GetItemInfo($Item['item_id']); $Index++; } return $Result; } }
public static function GetSpellByMisc($MiscValue) { $Statement = Items::$DBConnection->prepare('SELECT fs.*, LOWER(fsi.iconname) as icon FROM freedomcore_spell fs, freedomcore_spellicons fsi WHERE fs.effect1MiscValue = :mvalue AND fsi.id = fs.spellicon LIMIT 1'); $Statement->bindParam(':mvalue', $MiscValue); $Statement->execute(); $Result = $Statement->fetch(PDO::FETCH_ASSOC); if (Database::IsEmpty($Statement)) { return false; } else { return $Result; } }
private static function GetAchievements($Category) { $Statement = Events::$DBConnection->prepare('SELECT fa.*, LOWER(fsi.iconname) as icon FROM freedomcore_achievement fa LEFT JOIN freedomcore_spellicons fsi ON fa.icon = fsi.id WHERE category = :cat GROUP BY name_loc0'); $Statement->bindParam(':cat', $Category); $Statement->execute(); if (Database::IsEmpty($Statement)) { return false; } else { return $Statement->fetchAll(PDO::FETCH_ASSOC); } }
private static function getAccountByCharacterID($CharacterID) { $Statement = parent::$CharConnection->prepare('SELECT account FROM characters WHERE guid = :charid'); $Statement->bindParam(':charid', $CharacterID); $Statement->execute(); if (Database::IsEmpty($Statement)) { return false; } else { return $Statement->fetch(PDO::FETCH_ASSOC)['account']; } }
/** * This method checks for existing Armory Key for specified user * * @param $Username - Users Username * @param $Password - Users Password * @param $ArmoryKey - Personal Armory Key * @return bool */ public static function VerifyAndroidArmoryKey($Username, $Password, $ArmoryKey) { $StringToHash = $Username . ':' . $Password; $HashedPassword = Account::HashPassword('sha1', $StringToHash); $Statement = Account::$DBConnection->prepare('SELECT armory_key FROM api_android_armory WHERE username = :username AND password = :password AND armory_key = :akey'); $Statement->bindParam(':username', $Username); $Statement->bindParam(':password', $HashedPassword); $Statement->bindParam(':akey', $ArmoryKey); $Statement->execute(); if (Database::IsEmpty($Statement)) { return false; } else { return true; } }
<?php require_once 'header.php'; switch ($_REQUEST['action']) { case 'try_database': $Statement = Database::$AConnection->prepare('SELECT id FROM realmlist'); $Statement->execute(); $Result = $Statement->fetch(PDO::FETCH_ASSOC); if (Database::IsEmpty($Statement)) { echo 0; } else { echo 1; } break; case 'import_database': $ImportFolder = getcwd() . DS . 'Install' . DS . 'sql' . DS . 'imported' . DS; $SQLFolder = getcwd() . DS . 'Install' . DS . 'sql' . DS; global $FCCore; $NewFiles = File::GetDirectoryContent($SQLFolder, 'sql'); $OldFiles = File::GetDirectoryContent($ImportFolder, 'sql'); sort($NewFiles); $ArrayIndex = 0; foreach ($NewFiles as $File) { if (strstr($File['FileLink'], $ImportFolder)) { unset($NewFiles[$ArrayIndex]); } if (Installer::Import($FCCore['Database']['host'], $FCCore['Database']['username'], $FCCore['Database']['password'], $FCCore['Database']['database'], $FCCore['Database']['encoding'], $File['FileLink'])) { rename($File['FileLink'], $ImportFolder . $File['FileName']); } $ArrayIndex++; }