<?php

require "core/init.php";
if (!isset($_SESSION["id_korisnika"])) {
    header("Location:index.php");
    die;
}
if (isset($_GET["id_grada"]) && $_GET["id_vesti"]) {
    $id_grada = sanitize($_GET["id_grada"]);
    $id_vesti = sanitize($_GET["id_vesti"]);
    $vest = new Vest($id_vesti);
    if ($vest->postavi_grad($id_grada)) {
        echo "Grad je promenjen.";
    } else {
        echo "GRESKA: db->num != 1";
    }
} else {
    echo "GRESKA: nisu lepo setovane GET var";
}
<?php

/**
 * Created by PhpStorm.
 * User: Stefan
 * Date: 28.7.2015
 * Time: 19:09
 */
require "core/init.php";
if (!isset($_SESSION["id_korisnika"])) {
    header("Location:index.php");
    die;
}
if (isset($_GET['q']) && isset($_GET['kat']) && isset($_GET['grad'])) {
    $id = sanitize($_GET['q']);
    $kat = sanitize($_GET['kat']);
    $grad = sanitize($_GET['grad']);
    $v = new Vest($id);
    $v->postavi_grad($grad);
    if ($v->topublic($kat) == 1) {
        echo 'Vest je dodata.';
    } else {
        echo 'Greska tokom dodavanja vesti.';
    }
} else {
    echo 'Greska.';
}
<?php

/**
 * Created by PhpStorm.
 * User: Stefan
 * Date: 29.7.2015
 * Time: 20:03
 */
require_once "core/init.php";
if (!isset($_SESSION["id_korisnika"])) {
    header("Location:index.php");
    die;
} else {
    $id_korisnika = $_SESSION["id_korisnika"];
}
if (isset($_GET["q"]) && isset($_GET["lat"]) && isset($_GET["lng"]) && isset($_GET["naziv"])) {
    $id = sanitize($_GET["q"]);
    $lat = sanitize($_GET["lat"]);
    $lng = sanitize($_GET["lng"]);
    $naziv = sanitize($_GET["naziv"]);
    $n = new Vest($id);
    $id_n_g = $n->dodaj_grad($lat, $lng, $naziv, 0);
    if ($n->postavi_grad($id_n_g) == 1) {
        echo "Lokacija promenjena";
    } else {
        echo "Greska tokom promene lokacije";
    }
} else {
    echo 'Doslo je do greske (GET)';
}