【发布时间】:2013-02-27 07:56:04
【问题描述】:
我正在尝试设置一个将 Steam 用户 ID 转换为身份验证 ID 的网站。它会要求访问者输入他们的常规 Steam ID,然后点击按钮将其转换为身份验证 ID。 Steam 为我们提供了从一种类型到另一种类型的 ID 转换功能。
转换 ID 的 Steam 功能:
function convert_steamid_to_accountid($steamid)
{
$toks = explode(":", $steamid);
$odd = (int)$toks[1];
$halfAID = (int)$toks[2];
$authid = ($halfAID*2) + $odd;
echo $authid;
}
下面是我尝试设置一个基本的 HTML 页面,该页面获取用户输入,然后使用该函数将该输入转换为其他内容。
<INPUT TYPE = "Text" VALUE ="ENTER STEAM:ID" NAME = "idform">
<?PHP
$_POST['idform'];
$steamid = $_POST['idform'];
?>
另外,这是默认 Steam 用户 ID 的样子:
STEAM_0:1:36716545
感谢大家的帮助!
【问题讨论】:
标签: php function textbox steam