function masters_list()
{
    $q = new mysql();
    if (isset($_GET["delete"])) {
        $sql = "DELETE FROM vpnclient WHERE ID={$_GET["delete"]}";
        $q->QUERY_SQL($sql, "artica_backup");
        if ($q->ok) {
            $sock = new sockets();
            $sock->getFrameWork("openvpn.php?restart-clients=yes");
        }
    }
    $sql = "SELECT ID,enabled,servername,serverport,connexion_name,connexion_type,routes FROM vpnclient WHERE connexion_type=2 ORDER BY ID DESC";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t<thead class='thead'>\n\t\t<tH>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshOpenVPNMasterList()") . "</th>\n\t\t<th>{status}</th>\n\t\t<th>{connexion_name}</th>\n\t\t<th>{master_server}</th>\n\t\t<th>{port}</th>\n\t\t<th>{enable}</th>\n\t\t<th>&nbsp;</th>\n\t\t</tr>\n\t</thead>\n<tbody class='tbody'>\t\t\n\t";
    $sock = new sockets();
    $count = 0;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        //$js="EditVPNRemoteSite('{$ligne["ID"]}');";
        //$jsDownload="VPNRemoteSiteConfig('{$ligne["ID"]}');";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $running = $sock->getFrameWork("openvpn.php?is-client-running={$ligne["ID"]}");
        if ($running == "TRUE") {
            $img_running = "32-green.png";
        } else {
            $img_running = "danger32.png";
            $count = $count + 1;
        }
        $enabled = Field_numeric_checkbox_img("enabled_{$ligne["ID"]}", $ligne["enabled"], "{enable_disable}", "OPenVPNServerEnable");
        if ($ligne["enabled"] == 1) {
            $session_infos = sessions_infos($ligne["ID"]);
            $ligne["connexion_name"] = texttooltip($ligne["connexion_name"], $session_infos, null, null, 0, "font-size:13px");
            $ligne["servername"] = texttooltip($ligne["servername"], $session_infos, null, null, 0, "font-size:13px");
            $ligne["serverport"] = texttooltip($ligne["serverport"], $session_infos, null, null, 0, "font-size:13px");
        }
        $ahref = "<a href=\"javascript:blur();\" OnClick=\"javscript:EditVpnClientID('{$ligne["ID"]}')\" style='font-size:14px;text-decoration:underline'>";
        $html = $html . "\n\t\t\t<tr  class={$classtr}>\n\t\t\t<td  width=1% style='font-size:13px' valign='middle' align='center'>{$ahref}tun{$ligne["ID"]}</a></td>\n\t\t\t<td with=1% style='font-size:13px' valign='middle' align='center'><img src='img/{$img_running}'></td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ahref}{$ligne["connexion_name"]}</a></td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ahref}{$ligne["servername"]}</a></td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ahref}{$ligne["serverport"]}</a></td>\n\t\t\t<td nowrap valign='middle' align='center'>{$enabled}</td>\n\t\t\t<td width=1% valign='middle' align='center'>" . imgtootltip("delete-32.png", "{delete}", "RemoteClientVPNDelete('{$ligne["ID"]}')") . "</td>\n\t\t\t</tr>\n\t\t\n\t\t\t";
    }
    $buttonPLus = "\n\t\t<div style='text-align:right;padding:5px'>\n\t\t\t" . button("{reconnect_vpn_clients}", "OPenVPNReconnectClients()") . "\n\t\t</div>\n\t\t\n\t\t";
    $html = $html . "\n\t</table>{$buttonPLus}";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html, "users.openvpn.index.php");
}
function masters_list()
{
    $q = new mysql();
    if (isset($_GET["delete"])) {
        $sql = "DELETE FROM vpnclient WHERE ID={$_GET["delete"]}";
        $q->QUERY_SQL($sql, "artica_backup");
        if ($q->ok) {
            $sock = new sockets();
            $sock->getFrameWork("openvpn.php?restart-clients=yes");
        }
    }
    $sql = "SELECT ID,enabled,servername,serverport,connexion_name,connexion_type,routes FROM vpnclient WHERE connexion_type=2 ORDER BY ID DESC";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<th colspan=2>{type}</th>\n\t\t<th>{status}</th>\n\t\t<th>{connexion_name}</th>\n\t\t<th>{master_server}</th>\n\t\t<th>{port}</th>\n\t\t<th>{enable}</th>\n\t\t<th>{delete}</th>\n\t\t</tr>\n\t";
    $sock = new sockets();
    $count = 0;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        //$js="EditVPNRemoteSite('{$ligne["ID"]}');";
        //$jsDownload="VPNRemoteSiteConfig('{$ligne["ID"]}');";
        $running = $sock->getFrameWork("openvpn.php?is-client-running={$ligne["ID"]}");
        if ($running == "TRUE") {
            $img_running = "status_service_run.png";
        } else {
            $img_running = "status_service_removed.png";
            $count = $count + 1;
        }
        $enabled = Field_numeric_checkbox_img("enabled_{$ligne["ID"]}", $ligne["enabled"], "{enable_disable}", "OPenVPNServerEnable");
        if ($ligne["enabled"] == 1) {
            $session_infos = sessions_infos($ligne["ID"]);
            $ligne["connexion_name"] = texttooltip($ligne["connexion_name"], $session_infos, null, null, 0, "font-size:13px");
            $ligne["servername"] = texttooltip($ligne["servername"], $session_infos, null, null, 0, "font-size:13px");
            $ligne["serverport"] = texttooltip($ligne["serverport"], $session_infos, null, null, 0, "font-size:13px");
        }
        $html = $html . "\n\t\t\t<tr>\n\t\t\t<td colspan=8><hr></td></tr>\n\t\t\t<tr " . CellRollOver() . ">\n\t\t\t<td width=1%>" . imgtootltip("48-idisk-server.png", "{edit}", "EditVpnClientID('{$ligne["ID"]}')") . "</td>\n\t\t\t<td width=1% style='font-size:13px' valign='middle' align='center'>tun{$ligne["ID"]}</td>\n\t\t\t<td width=1% style='font-size:13px' valign='middle' align='center'><img src='img/{$img_running}'></td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ligne["connexion_name"]}</td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ligne["servername"]}</td>\n\t\t\t<td nowrap style='font-size:13px' valign='middle' align='center'>{$ligne["serverport"]}</td>\n\t\t\t<td nowrap valign='middle' align='center'>{$enabled}</td>\n\t\t\t<td width=1% valign='middle' align='center'>" . imgtootltip("48-bann-server-auto.png", "{delete}", "RemoteClientVPNDelete('{$ligne["ID"]}')") . "</td>\n\t\t\t</tr>\n\t\t\n\t\t\t";
    }
    $buttonPLus = "\n\t\t<div style='text-align:right;padding:5px'>\n\t\t\t" . button("{reconnect_vpn_clients}", "OPenVPNReconnectClients()") . "\n\t\t</div>\n\t\t\n\t\t";
    $html = $html . "\n\t</table>{$buttonPLus}";
    $html = RoundedLightWhite($html);
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html, "users.openvpn.index.php");
}