mirror of
https://github.com/ZeroDream-CN/SakuraPanel.git
synced 2025-01-12 09:52:52 +08:00
Fixed STCP and XTCP sk issues
修复 STCP 和 XTCP 映射模式的 SK 判断问题
This commit is contained in:
parent
c448787fcd
commit
66d2d0f004
@ -101,10 +101,11 @@ if((isset($_GET['apitoken']) && $_GET['apitoken'] == API_TOKEN) || (isset($_GET[
|
|||||||
$proxyName = str_replace("{$_GET['user']}.", "", $_GET['proxy_name']);
|
$proxyName = str_replace("{$_GET['user']}.", "", $_GET['proxy_name']);
|
||||||
$proxyType = $_GET['proxy_type'] ?? "tcp";
|
$proxyType = $_GET['proxy_type'] ?? "tcp";
|
||||||
$remotePort = Intval($_GET['remote_port']) ?? "";
|
$remotePort = Intval($_GET['remote_port']) ?? "";
|
||||||
|
$sk = Database::escape($_GET['sk'] ?? "");
|
||||||
$userToken = Database::escape($_GET['user']);
|
$userToken = Database::escape($_GET['user']);
|
||||||
$rs = Database::querySingleLine("tokens", ["token" => $userToken]);
|
$rs = Database::querySingleLine("tokens", ["token" => $userToken]);
|
||||||
if($rs) {
|
if($rs) {
|
||||||
if($proxyType == "tcp" || $proxyType == "udp" || $proxyType == "stcp" || $proxyType == "xtcp") {
|
if($proxyType == "tcp" || $proxyType == "udp") {
|
||||||
if(isset($remotePort) && Regex::isNumber($remotePort)) {
|
if(isset($remotePort) && Regex::isNumber($remotePort)) {
|
||||||
$username = Database::escape($rs['username']);
|
$username = Database::escape($rs['username']);
|
||||||
// 这里只对远程端口做限制,可根据自己的需要修改
|
// 这里只对远程端口做限制,可根据自己的需要修改
|
||||||
@ -125,6 +126,27 @@ if((isset($_GET['apitoken']) && $_GET['apitoken'] == API_TOKEN) || (isset($_GET[
|
|||||||
} else {
|
} else {
|
||||||
Utils::sendServerBadRequest("Invalid request");
|
Utils::sendServerBadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
|
} elseif($proxyType == "stcp" || $proxyType == "xtcp") {
|
||||||
|
if(isset($sk) && !empty($sk)) {
|
||||||
|
$username = Database::escape($rs['username']);
|
||||||
|
// 这里只对 SK 做限制,可根据自己的需要修改
|
||||||
|
$rs = Database::querySingleLine("proxies", [
|
||||||
|
"username" => $username,
|
||||||
|
"sk" => $sk,
|
||||||
|
"proxy_type" => $proxyType,
|
||||||
|
"node" => $switchNode
|
||||||
|
]);
|
||||||
|
if($rs) {
|
||||||
|
if($rs['status'] !== "0") {
|
||||||
|
Utils::sendServerForbidden("Proxy disabled");
|
||||||
|
}
|
||||||
|
Utils::sendCheckSuccessful("Proxy exist");
|
||||||
|
} else {
|
||||||
|
Utils::sendServerNotFound("Proxy not found");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils::sendServerBadRequest("Invalid request");
|
||||||
|
}
|
||||||
} elseif($proxyType == "http" || $proxyType == "https") {
|
} elseif($proxyType == "http" || $proxyType == "https") {
|
||||||
if(isset($_GET['domain']) || isset($_GET['subdomain'])) {
|
if(isset($_GET['domain']) || isset($_GET['subdomain'])) {
|
||||||
// 目前只验证域名和子域名
|
// 目前只验证域名和子域名
|
||||||
|
Loading…
Reference in New Issue
Block a user