dezkit Posted August 22, 2009 Share Posted August 22, 2009 I have a script which can perfectly covert a SteamID to their Steam Community ID with this code: <?php function getFriendId($steamId) { //Test input steamId for invalid format //Example SteamID: "STEAM_X:Y:ZZZZZZZZ" $gameType = 0; //This is X. It's either 0 or 1 depending on which game you are playing (CSS, L4D, TF2, etc) $authServer = 0; //This is Y. Some people have a 0, some people have a 1 $clientId = ''; //This is ZZZZZZZZ. //Remove the "STEAM_" $steamId = str_replace('STEAM_', '' ,$steamId); //Split steamId into parts $parts = explode(':', $steamId); $gameType = $parts[0]; $authServer = $parts[1]; $clientId = $parts[2]; //Calculate friendId $result = bcadd((bcadd('76561197960265728', $authServer)), (bcmul($clientId, '2'))); return($result); } echo(getFriendId('STEAM_0:0:1')); ?> But I can't seem to make a form with this script, can somebody help me out? Thank you. Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/ Share on other sites More sharing options...
trq Posted August 22, 2009 Share Posted August 22, 2009 But I can't seem to make a form with this script What does that mean exactly? Forms are made with html. Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903772 Share on other sites More sharing options...
dezkit Posted August 22, 2009 Author Share Posted August 22, 2009 But I can't seem to make a form with this script What does that mean exactly? Forms are made with html. Well, <?php function getFriendId($steamId) { //Test input steamId for invalid format //Example SteamID: "STEAM_X:Y:ZZZZZZZZ" $gameType = 0; //This is X. It's either 0 or 1 depending on which game you are playing (CSS, L4D, TF2, etc) $authServer = 0; //This is Y. Some people have a 0, some people have a 1 $clientId = ''; //This is ZZZZZZZZ. //Remove the "STEAM_" $steamId = str_replace('STEAM_', '' ,$steamId); //Split steamId into parts $parts = explode(':', $steamId); $gameType = $parts[0]; $authServer = $parts[1]; $clientId = $parts[2]; //Calculate friendId $result = bcadd((bcadd('76561197960265728', $authServer)), (bcmul($clientId, '2'))); return($result); } echo(getFriendId('STEAM_0:0:1')); ?> Gives me the correct page of that steamid, but if I do this... <?php function getFriendId($steamId) { //Test input steamId for invalid format //Example SteamID: "STEAM_X:Y:ZZZZZZZZ" $gameType = 0; //This is X. It's either 0 or 1 depending on which game you are playing (CSS, L4D, TF2, etc) $authServer = 0; //This is Y. Some people have a 0, some people have a 1 $clientId = ''; //This is ZZZZZZZZ. //Remove the "STEAM_" $steamId = str_replace('STEAM_', '' ,$steamId); //Split steamId into parts $parts = explode(':', $steamId); $gameType = $parts[0]; $authServer = $parts[1]; $clientId = $parts[2]; //Calculate friendId $result = bcadd((bcadd('76561197960265728', $authServer)), (bcmul($clientId, '2'))); return($result); } $id = $_GET["id"]; echo(getFriendId('$id')); ?> It won't work. Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903777 Share on other sites More sharing options...
trq Posted August 22, 2009 Share Posted August 22, 2009 Variables aren't parsed within single quotes, and echo is not a function (does not require braces around its arguments). echo getFriendId($id); Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903779 Share on other sites More sharing options...
trq Posted August 22, 2009 Share Posted August 22, 2009 ps: return is not a function either. return $result; Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903781 Share on other sites More sharing options...
dezkit Posted August 22, 2009 Author Share Posted August 22, 2009 Variables aren't parsed within single quotes, and echo is not a function (does not require braces around its arguments). echo getFriendId($id); .... I'm stupid. Lol, thanks for that Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903782 Share on other sites More sharing options...
dezkit Posted August 22, 2009 Author Share Posted August 22, 2009 Is there a way to remove the %3A in the url after searching? http://newzonemedia.com/steamid.php <body bgcolor="red"> <center> <form action="" method="get"> <input type="text" name="id" value="<?php echo $_GET['id'];?>"> <input type="submit"> <br>Script made by dezkit. </center> </form> <?php function getFriendId($steamId) { //Test input steamId for invalid format //Example SteamID: "STEAM_X:Y:ZZZZZZZZ" $gameType = 0; //This is X. It's either 0 or 1 depending on which game you are playing (CSS, L4D, TF2, etc) $authServer = 0; //This is Y. Some people have a 0, some people have a 1 $clientId = ''; //This is ZZZZZZZZ. //Remove the "STEAM_" $steamId = str_replace('STEAM_', '' ,$steamId); //Split steamId into parts $parts = explode(':', $steamId); $gameType = $parts[0]; $authServer = $parts[1]; $clientId = $parts[2]; //Calculate friendId $result = bcadd((bcadd('76561197960265728', $authServer)), (bcmul($clientId, '2'))); return $result; } $id = $_GET["id"]; echo "<iframe src='http://www.steamcommunity.com/profiles/".getFriendId($id)."' width='100%' height='100%'>"; ?> Link to comment https://forums.phpfreaks.com/topic/171377-steamid-steam-community-id/#findComment-903793 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.