Esempio n. 1
0
File: rg2api.php Progetto: AtleH/rg2
} else {
    $type = 'unknown';
}
if (isset($_GET['id'])) {
    $id = $_GET['id'];
} else {
    $id = 0;
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    handleGetRequest($type, $id);
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if ($type == 'uploadmapfile') {
            uploadMapFile();
        } else {
            handlePostRequest($type, $id);
        }
    } else {
        header('HTTP/1.1 405 Method Not Allowed');
        header('Allow: GET, POST');
    }
}
// Note: convert encoding read from kartat files to encoding use in rg2 browser
// Handle the encoding for input data if kartat directory files are not using RG2_ENCODING encoding
//
function encode_rg_input($input_str)
{
    $encoded = '';
    if (RG_FILE_ENCODING != RG2_ENCODING) {
        //
        $encoded = @iconv(RG_FILE_ENCODING, RG2_ENCODING . '//TRANSLIT//IGNORE', $input_str);
Esempio n. 2
0
File: index.php Progetto: Eworm/BIS
<?php

include_once "../include_globalVars.php";
include_once "../inschrijving_methods.php";
setlocale(LC_TIME, 'nl_NL');
$request_method = strtolower($_SERVER['REQUEST_METHOD']);
if ($request_method == 'post') {
    if (validateToken($_POST)) {
        if ($_POST['delete'] == 1) {
            handleDeleteRequest($_POST);
        } else {
            handlePostRequest($_POST);
        }
    } else {
        die(sendResponse(401));
    }
} else {
    if ($request_method == 'get') {
        if (isset($_GET['getToken']) && $_GET['getToken'] == 1) {
            if (validateApiLogin($_GET)) {
                sendResponse(200, makeToken());
            } else {
                die(sendResponse(401));
            }
        } else {
            if (validateToken($_GET)) {
                handleGetRequest($_GET);
            } else {
                die(sendResponse(401));
            }
        }