mirror of
https://github.com/ZeroDream-CN/SakuraPanel.git
synced 2025-01-12 01:42: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']);
|
||||
$proxyType = $_GET['proxy_type'] ?? "tcp";
|
||||
$remotePort = Intval($_GET['remote_port']) ?? "";
|
||||
$sk = Database::escape($_GET['sk'] ?? "");
|
||||
$userToken = Database::escape($_GET['user']);
|
||||
$rs = Database::querySingleLine("tokens", ["token" => $userToken]);
|
||||
if($rs) {
|
||||
if($proxyType == "tcp" || $proxyType == "udp" || $proxyType == "stcp" || $proxyType == "xtcp") {
|
||||
if($proxyType == "tcp" || $proxyType == "udp") {
|
||||
if(isset($remotePort) && Regex::isNumber($remotePort)) {
|
||||
$username = Database::escape($rs['username']);
|
||||
// 这里只对远程端口做限制,可根据自己的需要修改
|
||||
@ -125,6 +126,27 @@ if((isset($_GET['apitoken']) && $_GET['apitoken'] == API_TOKEN) || (isset($_GET[
|
||||
} else {
|
||||
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") {
|
||||
if(isset($_GET['domain']) || isset($_GET['subdomain'])) {
|
||||
// 目前只验证域名和子域名
|
||||
|
Loading…
Reference in New Issue
Block a user