Advertisement
monsterkiller

steamid converter

Jan 8th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1.     public function Steam64ToID($Steam64, $NewID = false) {
  2.         if(!$NewID) {
  3.             $Server = bcsub($Steam64, '76561197960265728') & 1;
  4.             $Auth = (string)bcdiv(bcsub(bcsub($Steam64, '76561197960265728'), $Server), '2');
  5.             if(strpos($Auth, '.') !== false)
  6.                 $Auth = substr($Auth, 0, strpos($Auth, '.'));
  7.             $SteamID = 'STEAM_0:'.$Server.':'.$Auth;
  8.             if($this->ValidID($SteamID, 1))
  9.                 return $SteamID;
  10.         } else {
  11.             $Server = bcsub($Steam64, '76561197960265728') & 1;
  12.             $Auth = bcsub(bcsub($Steam64, '76561197960265728'), $Server);
  13.             $ID = (int)bcadd($Auth, $Server);
  14.             $SteamID = '[U:1:'.$ID.']';
  15.             if($this->ValidID($SteamID, 2))
  16.                 return $SteamID;
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement