<?php
include '../config.php';

//Get pro servers api
if (isset($_GET['pkg'])) {

    $qd =  $conn->query("SELECT * FROM `admob` WHERE `id`= 1");
    $data = array();


    $qs =  $conn->query("SELECT * FROM servers WHERE `status`=1 ORDER by `pos` DESC");
    $servers_list = array();
    while ($row =  $qs->fetch_array()) {
        array_push($servers_list, $row);
    }

    while ($row = $qd->fetch_array()) {

        $r['app_id'] = $row['1'];
        $r['banner'] = $row['2'];
        $r['interstitial'] = $row['3'];
        $r['native'] = $row['4'];
        $r['active'] = $row['5'];
        $r['servers'] = $servers_list;

        array_push($data, $r);
    }
    echo json_encode($data);
}
