Quote:
Originally Posted by 8088
I've received some requests to share the code I used to create this page, so I've attached a complete, working page below. It's nothing more than a compilation of what has been said/shared before in this thread.
|
Hi, this php code does not work for me. (Attachment steamid.zip)
Look at my code
Code:
<?php /*
SteamID conversion tool by 8088 & KoST
For more info, visit AlliedModders @ http://forums.alliedmods.net/showthread.php?t=60899
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SteamID Converter</title>
</head>
<body>
<style>
a:visited {
font-weight: bold;
color: #333;
text-decoration: none;
}
a:hover {
text-decoration: underline;
color: #111;
}
a:link {
font-weight: bold;
color: #333;
text-decoration: none;
}
input.button:hover {
border: 2px solid #000000;
}
input.button {
border: 2px solid #555555;
border-radius: 5px 5px 5px 5px;
cursor: pointer;
font-weight: bold;
}
body {
background-color: #D3D3D3;
}
legend {
background-color: #999999;
border: 2px solid #555555;
border-radius: 10px 10px 10px 10px;
padding: 0 10px;
}
fieldset {
background-color: #DDDDDD;
border: 2px solid #555555;
border-radius: 10px 10px 10px 10px;
font-weight: bold;
}
li {
list-style: none outside none;
margin-left: -30px;
}
.blockhead {
background-color: #DDDDDD;
border: 2px dashed #555555;
border-radius: 30px 30px 30px 30px;
font-family: arial;
font-size: 20px;
margin-bottom: 50px;
padding: 10px;
text-align: center;
}
</style>
<table align="center" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td valign="top">
<form method="get" action="">
<h2 class="blockhead">Introduzca un SteamID, friendID o customURL para buscar el respectivo ID</h2>
<fieldset>
<legend>Ejemplos</legend>
<ul>
<li type="disc"><span style="font-size:14px;">STEAM_0:<span style="color:#ff6600;">X</span>:<span style="color:#ff6600;">XXXX</span></span></li>
<li><span style="font-size:14px;">7656119<span style="color:#ff6600;">XXXXXXXXXX</span></span></li>
<li><span style="font-size:14px;color:#ff6600;"><customURL></span></li>
<li><span style="font-size:14px;">http://steamcommunity.com/profiles/7656119<span style="color:#ff6600;">XXXXXXXXXX</span></span></li>
<li><span style="font-size:14px;">http://steamcommunity.com/id/<span style="color:#ff6600;"><customURL></span></span></li>
</ul>
</fieldset>
<br>
<fieldset>
<legend>Formulario</legend>
<table>
<tbody>
<tr>
<td>SteamID / FriendID / customURL:<br>
<input type="text" size="70" name="s" value="<?php echo htmlentities(stripslashes($_GET['s']),ENT_QUOTES); ?>">
</td>
</tr>
<tr>
<td align="right">
<input class="button" type="submit" accesskey="s" value="Enviar">
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
<br />
<?php
$ret=get_input_type($_GET['s']);
if ($ret==''){
}else if (is_string($ret)){
echo '<div><fieldset><legend>Resultado</legend><table><tbody><tr><td>';
echo $ret;
echo '</td></tr></tbody></table></fieldset>';
if ($_GET['s']!=='') { echo $notice; }
echo '</div>';
}else if (is_array($ret)){
echo '<div><fieldset><legend>Resultado</legend><table><tbody><tr><td>';
convert($ret['type'],$ret['data']);
echo '</td></tr></tbody></table></fieldset>';
if ($_GET['s']!=='') { echo $notice;}
echo '</div>';
}
function convert($type,$data){
switch($type){
case 'steamid':
$main='http://steamcommunity.com/profiles/'.bcadd((($data['auth']*2)+$data['server']),'76561197960265728');
echo 'FriendID: <a href="'.$main.'" title="Visit Steam Community page" target="blank">'.bcadd((($data['auth']*2)+$data['server']),'76561197960265728').'</a>';
break;
case 'friendid':
if (substr($data,-1)%2==0) $server=0; else $server=1;
$auth=bcsub($data,'76561197960265728');
if (bccomp($auth,'0')!=1) {echo "Error: invalid FriendID or SteamID";return;}
$auth=bcsub($auth,$server);
$auth=bcdiv($auth,2);
echo 'SteamID: STEAM_0:'.$server.':'.$auth;
break;
}
}
function get_input_type($data){
$data=strtolower(trim($data));
if ($data!='') {
if (strlen($data)>80) return "too long";
if (substr($data,0,7)=='steam_0') {
$tmp=explode(':',$data);
if ((count($tmp)==3) && is_numeric($tmp[1]) && is_numeric($tmp[2])){
return array('type'=>'steamid','data'=>array('auth'=>$tmp[2],'server'=>$tmp[1]));
}else{
return "Error: invalid SteamID";
}
}else if ($p=strrpos($data,'/')){
$tmp=explode('/',$data);
foreach ($tmp as $item){
if (is_numeric($item)){
$a=$item;
break;
}
}
if ((is_numeric($a)) && (ereg('7656119', $a))) return array('type'=>'friendid','data'=>$a);
else {
$xml = @simplexml_load_file($data."?xml=1");
$steamid64=$xml->steamID64;
if (!ereg('7656119', $steamid64)) return "Error: invalid link";
else return array('type'=>'friendid','data'=>$steamid64);
}
}else if ((is_numeric($data)) && (ereg('7656119', $data))){
return array('type'=>'friendid','data'=>$data);
}else{
$xml = @simplexml_load_file("http://steamcommunity.com/id/".$data."?xml=1");
$steamid64=$xml->steamID64;
if (!ereg('7656119', $steamid64)) return "Error: invalid input";
else return array('type'=>'friendid','data'=>$steamid64);
}
}else{
return "";
}
}
?>
<center><span class="smallfont" style="color:#444;"><font size="3">Visita <a href="http://steamidconverter.com">SteamIdConverter.com</a> para utilizar la versión mejorada.</font></span></center><br />
<font size="2">
<span class="smallfont" style="color:#444;"><center>Gracias a <a href="http://forums.alliedmods.net/member.php?u=2557" title="voogru" target="blank">voogru</a> por este algoritmo a <a href="http://forums.alliedmods.net/member.php?u=6220" title="KoST">KoST</a> por la conversión a php, y a <a href="http://www.noobsticks.com/members/8088/" title="8088">8088</a> por su script. <br />Para obtener más información acerca de cómo convertir a SteamIDs FriendIDs y viceversa, Visita: <br>
<a href="http://forums.alliedmods.net/showthread.php?t=60899" title="Allied Modders" target="blank"><i>Allied Modders : Convert STEAMID to Community ID</i></a>.<br /><br /><b>WebExtra By Xilver266</b></center></span>
</font>
</td>
</tr>
</table>
</body>
</html>
Look at my Web
http://clan-assassins.22web.net/steamid.php
Help Please!