Ejemplo n.º 1
0
function getRanking($con, $type, $status, $range, $limit, $start)
{
    $resArray = $con->getRanking($type, $status, $range, $limit, $start);
    if ($resArray["Status"] < 0) {
        show_error($resArray["Status"], $resArray["Content"]);
    } else {
        if ($resArray["Status"] == 0) {
            sentJSON(0, "無資料", null);
        } else {
            sentJSON($resArray["Status"], "成功取得清單", $resArray["Content"]);
        }
    }
}
//連線至資料庫,並開始準備查詢
$con = new dbConnections();
if ($con->status()) {
    //先把URI全部轉大寫省麻煩
    $API = strtoupper($_SERVER["REQUEST_URI"]);
    //確認資料放在GET還是POST
    //另一種方法是$_SERVER["REQUEST_METHOD"]
    if (isset($_GET["UID"])) {
        $dataForm = $_GET;
        $API = substr($API, 0, strrpos($_SERVER["REQUEST_URI"], "?"));
    } else {
        if (isset($_POST["UID"])) {
            $dataForm = $_POST;
        } else {
            show_error(-1, "請輸入UID");
        }
    }
    if (isset($dataForm)) {