コード例 #1
0
ファイル: admin_test.php プロジェクト: strall/easy-ride
function trip_spots()
{
    echo '<br>';
    $trip = database\get_trip(1);
    echo json_encode($trip);
    echo '<br>';
    $ride_status = database\get_ride_request_status(1, 1);
    echo json_encode($ride_status);
    echo json_encode(database\update_ride_request_status(1, 1, 'APPROVED'));
}
コード例 #2
0
ファイル: trips_ajax.php プロジェクト: strall/easy-ride
function update_ride_request_status($driver_id, $data)
{
    $trip = database\get_trip($data['trip_id']);
    if ($trip['driver_id'] != $driver_id) {
        return functions\json_respond('ERROR', 'Unauthorized access!');
    }
    $spots_remaining = database\update_ride_request_status($data['user_id'], $data['trip_id'], $data['status']);
    if ($spots_remaining < 0) {
        return functions\json_respond('ERROR', 'Insufficient spots!');
    }
    functions\json_respond('OK', 'Query performed!', array("spots_remaining" => $spots_remaining));
}