-
Notifications
You must be signed in to change notification settings - Fork 234
/
updateShareConfig.php
34 lines (29 loc) · 1014 Bytes
/
updateShareConfig.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require "baseInfo.php";
require "config.php";
$stmt = $connection->prepare("SELECT * FROM `server_plans` WHERE (`type` IS NULL OR `type` = '') AND `inbound_id` != 0");
$stmt->execute();
$list = $stmt->get_result();
$stmt->close();
if($list->num_rows > 0){
while($row = $list->fetch_assoc()){
$serverId = $row['server_id'];
$inboundId = $row['inbound_id'];
$rowId = $row['id'];
$response = getJson($serverId);
$response = $response->obj;
foreach($response as $config){
if($config->id == $inboundId) {
$netType = json_decode($config->streamSettings)->network;
break;
}
}
if(!is_null($netType)){
$stmt = $connection->prepare("UPDATE `server_plans` SET `type` = ? WHERE `id` = ?");
$stmt->bind_param("si", $netType, $rowId);
$stmt->execute();
$stmt->close();
}
}
echo "REFRESH PAGE";
}else echo "DONE";