<?php

/**
 * Created by PhpStorm.
 * User: simon
 * Date: 15/02/16
 * Time: 11:28 PM
 */
require_once './default-init.php';
require_once './db/db-config.php';
require_once './db/db-operation.php';
require_once './api/sl_login.php';
$query = new express_db();
if (isset($_GET["action"]) && $_GET["action"] == "get_senders") {
    $query->senders_query();
} else {
    if (isset($_GET["action"]) && $_GET["action"] == "get_sender_user_name") {
        $query->sender_query_user_name($_GET["user_name"]);
    } else {
        if (isset($_GET["action"]) && $_GET["action"] == "get_receivers") {
            $query->receivers_query_sender_id($_GET["id"]);
        } else {
            if (isset($_GET["action"]) && $_GET["action"] == "save_receiver") {
                $query->receiver_insert($_GET['sender_id'], $_GET["receiver_name"], $_GET["receiver_phone"], $_GET["receiver_province"], $_GET["receiver_city"], $_GET["receiver_address"]);
            } else {
                if (isset($_GET["action"]) && $_GET["action"] == "update_receiver") {
                    $query->receiver_update($_GET['receiver_id'], $_GET['sender_id'], $_GET["receiver_name"], $_GET["receiver_phone"], $_GET["receiver_province"], $_GET["receiver_city"], $_GET["receiver_address"]);
                } else {
                    if (isset($_GET["action"]) && $_GET["action"] == "get_products") {
                        $query->products_query_search();
                    } else {