<?php
require('../panel.sbtvpnhub.xyz/user/extension/connect.php');
header('Content-Type: application/json');

$servers = "SELECT * FROM servers2";
$result = mysqli_query($con, $servers);

$version = "SELECT * FROM server_version";
$versionR = mysqli_query($con, $version);
$version = mysqli_fetch_assoc($versionR);

$version = number_format($version['version'], 1, '.', '');  // Outputs -> 105.00

$data = [];
$data['VERSION'] = $version;

while ($rows = mysqli_fetch_assoc($result)) {
    $data['Servers'][] = [
        "Name" => $rows['server_name'],
        "ServerIPHost" => $rows['server_ip'],
        "Category" => "PREMIUM",
        "OpenVPNTCPPort" => "1194",
        "OpenVPNSSLPort" => "443",
        "flag" => $rows['country'],

    ];
}

echo json_encode($data, JSON_PRETTY_PRINT);