Example #1
0
<?php

//chdir(dirname(__DIR__));
//set_include_path('/var/www/valuation/ip/api/');
require_once 'vendor/JWT/JWT.php';
require_once 'lib/password.php';
require_once 'lib/Request.php';
require_once 'config/Config.php';
require_once 'lib/DbUtils.php';
use IP\Request;
use IP\Config;
use IP\DbUtils as DB;
$request = new Request();
$db = new DB();
$request->setAccessHeader();
if ($request->handleOptions()) {
    error_log('Option request. Exit...', 0);
    exit;
}
if (!$request->isPOST()) {
    error_log('Only POST method allowed', 0);
    header('HTTP/1.0 405 Method Not Allowed');
    exit;
}
$input = $request->getJSON();
/*
 * Simple sanitization
 */
//$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
//$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
$username = $input->username;