Unsupported PHP app for analysing and displaying stats for Team Fortress 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

community.php 627B

1234567891011121314151617181920212223242526272829
  1. <?PHP
  2. define('COMMUNITY_KEY', '76561197960265729');
  3. function getCommunityID($steamID) {
  4. $parts = explode(':', $steamID);
  5. $id = array_pop($parts);
  6. return stringAdd(COMMUNITY_KEY, (string) ($id * 2));
  7. }
  8. function stringAdd($stringA, $stringB) {
  9. $carry = 0;
  10. for ($i = 1; $i <= strlen($stringB) || $carry > 0; $i++) {
  11. $val = ord($stringA[strlen($stringA) - $i]) + $carry - 48;
  12. if ($i <= strlen($stringB)) {
  13. $val += ord($stringB[strlen($stringB) - $i]) - 48;
  14. }
  15. $carry = floor($val / 10);
  16. $val = 48 + ($val % 10);
  17. $stringA[strlen($stringA) - $i] = chr($val);
  18. }
  19. return $stringA;
  20. }
  21. ?>