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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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); Quote Link to comment 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; Quote Link to comment 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 Quote Link to comment 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%'>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.