Skip to content

Commit 6ce972e

Browse files
authored
Create updateShareConfig.php
1 parent 1de8c37 commit 6ce972e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

updateShareConfig.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
require "baseInfo.php";
4+
require "config.php";
5+
6+
$stmt = $connection->prepare("SELECT * FROM `server_plans` WHERE (`type` IS NULL OR `type` = '') AND `inbound_id` != 0");
7+
$stmt->execute();
8+
$list = $stmt->get_result();
9+
$stmt->close();
10+
11+
if($list->num_rows > 0){
12+
while($row = $list->fetch_assoc()){
13+
$serverId = $row['server_id'];
14+
$inboundId = $row['inbound_id'];
15+
$rowId = $row['id'];
16+
17+
$response = getJson($serverId);
18+
$response = $response->obj;
19+
foreach($response as $config){
20+
if($config->id == $inboundId) {
21+
$netType = json_decode($config->streamSettings)->network;
22+
break;
23+
}
24+
}
25+
26+
if(!is_null($netType)){
27+
$stmt = $connection->prepare("UPDATE `server_plans` SET `type` = ? WHERE `id` = ?");
28+
$stmt->bind_param("si", $netType, $rowId);
29+
$stmt->execute();
30+
$stmt->close();
31+
}
32+
}
33+
echo "REFRESH PAGE";
34+
}else echo "DONE";

0 commit comments

Comments
 (0)