Skip to content

Commit 1b07905

Browse files
committed
Fixed ID format for blocking
Fix #259
1 parent 443918c commit 1b07905

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

web/includes/system-functions.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,14 @@ function GetCommunityName($steamid)
11621162
return "";
11631163
}
11641164

1165+
function steam2to3($authid)
1166+
{
1167+
$GLOBALS['PDO']->query("SELECT CONCAT(CAST('".$authid."' AS UNSIGNED) % 2, \":\", CAST('".$authid."' AS UNSIGNED) / 2) AS id");
1168+
$result = $GLOBALS['PDO']->single();
1169+
$result = explode(':', $result['id']);
1170+
return 'STEAM_0:' . $result[0] . ':' . floor($result[1]);
1171+
}
1172+
11651173
function SendRconSilent($rcon, $sid)
11661174
{
11671175
require_once(INCLUDES_PATH.'/CServerRcon.php');

web/pages/admin.blockit.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,20 @@ function BlockPlayer($check, $sid, $num, $type, $length)
107107

108108
$gothim = false;
109109
$search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
110+
110111
//search for the steamid on the server
111-
foreach ($matches[3] AS $match) {
112+
foreach ($matches[3] as $match) {
113+
if (!preg_match(STEAM_FORMAT, $match)) {
114+
$match = explode(':', $match);
115+
$match = steam2to3(rtrim($match[2], ']'));
116+
}
112117
if (substr($match, 8) == substr($check, 8)) {
113118
// gotcha!!! kick him!
114119
$gothim = true;
115120
$GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_comms` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
116121
$requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.blockit.php"));
117122
$kick = $r->sendCommand("sc_fw_block " . $type . " " . $length . " " . $match);
118-
$objResponse->addAssign("srv_$num", "innerHTML", "<font color='green' size='1'><b><u>Player Found & blocked!!!</u></b></font>");
123+
$objResponse->addAssign("srv_$num", "innerHTML", "<font color='green' size='1'><b><u>Player Found & blocked!</u></b></font>");
119124
$objResponse->addScript("set_counter('-1');");
120125
return $objResponse;
121126
}

web/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"version": "1.6.2",
3-
"git": "511"
3+
"git": "514"
44
}

0 commit comments

Comments
 (0)