Skip to content

Instantly share code, notes, and snippets.

@29942016
Last active December 29, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 29942016/7719039 to your computer and use it in GitHub Desktop.
Save 29942016/7719039 to your computer and use it in GitHub Desktop.
Convert a SteamID to a ID64 or 'Community ID'
<?php
$steamid = $_POST['steamidbutton']; //Retrieves steam ID from textbox on page post
$split = explode(":", $steamid);
$x = substr($split[0],6,1);
$y = $split[1];
$z = $split[2];
//Steams algorithm for creating IDs, more info can be found on steams web api FAQ
$NewSteamID = (($z * 2)+$y);
//Convert to ID64 by adding finalised $NewSteamId to the base number used by steam
$NewSteamID = bcadd($NewSteamID, "76561197960265728", 0);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment