ob_start(); include_once 'baza.class.php'; $baza = new baza(); $baza->spojiDB(); $id = isset($_POST['id']) ? $_POST['id'] : false; $table = isset($_POST['table']) ? $_POST['table'] : false; $tip = isset($_POST['tip']) ? $_POST['tip'] : false; if ($id && $table && $tip) { if ($table == "ppKorisnik") { $table = "Korisnik"; } if ($table == "POCETNA") { $table = "Ruta"; } if ($table != "GENMAIL") { echo dohvatiPod($baza, $id, $table, $tip); } if ($table == "GENMAIL") { if ($tip == 1) { $paket = isset($_POST['paket']) ? $_POST['paket'] : false; $mailPoruka = "Obavijestavamo Vas da paket, naziva {$paket} nazalost nije isporučen!"; mail($id, "Obavijest o neisporuci!", $mailPoruka); if (!isset($_SESSION)) { session_start(); } Baza_Radnje("Not.mail {$id},paket-naziv: {$paket} ", $_SESSION['email'], 2); echo 1; } //ako je poslati odredenom korisniku if ($tip == 44) { if (!isset($_SESSION)) {
$upit = "Select kor_ime,prezime,ime,email,lozinka,status,broj_neusp from " . $table . " ORDER BY " . $name . " " . $order . ""; $podaci = $baza->selectUpit($upit); $i = 0; while ($red = $podaci->fetch_array()) { $response[$i]['kor_ime'] = $red['kor_ime']; $response[$i]['prezime'] = $red['prezime']; $response[$i]['ime'] = $red['ime']; $response[$i]['email'] = $red['email']; $response[$i]['lozinka'] = $red['lozinka']; $response[$i]['status'] = $red['status']; $response[$i]['broj_neusp'] = $red['broj_neusp']; $i = $i + 1; } echo json_encode($response); } else { echo dohvatiPod($baza, $name, $table, $order); } } function dohvatiPod($baza, $name, $table, $order) { if ($name == "ZZ") { $upit = "Select * from " . $table . " ORDER BY 1 " . $order . ""; } else { $upit = "Select * from " . $table . " ORDER BY " . $name . " " . $order . ""; } if ($table == "Ruta_cijena") { $upit = "Select DISTINCT(naziv) from Ruta ORDER BY " . $name . " " . $order . ""; } if ($table == "GALSLIKA") { $upit = "Select COUNT(*)id_paket from Paket"; }