Ejemplo n.º 1
0
function odrediste($idr)
{
    require_once 'baza.class.php';
    $baza = new baza();
    $upit = "SELECT mjesta_idmjesta FROM rute_has_mjesta WHERE rute_idrute={$idr} ORDER BY redosljed DESC LIMIT 1";
    $podaci = $baza->selectUpit($upit);
    $l = $podaci->fetch_array();
    return $l['mjesta_idmjesta'];
}
Ejemplo n.º 2
0
 public function ksid($korisnicko_ime)
 {
     require_once 'baza.class.php';
     if (!isset($baza)) {
         $baza = new baza();
     }
     $upit = "SELECT k.idkurirske_sluzbe, ks.naziv_sluzbe FROM korisnici k LEFT JOIN kurirske_sluzbe ks ON (k.idkurirske_sluzbe=ks.idkurirske_sluzbe) WHERE k.korisnicko_ime='{$korisnicko_ime}'";
     $res = $baza->selectUpit($upit);
     $l = $res->fetch_assoc();
     return $l['idkurirske_sluzbe'];
 }
Ejemplo n.º 3
0
function vrsta($idzahtjeva)
{
    require_once 'baza.class.php';
    if (!isset($baza)) {
        $baza = new baza();
    }
    $upit = "SELECT *from tip_dostave where idtip_dostave={$idzahtjeva} LIMIT 1";
    $res = $baza->selectUpit($upit);
    $l = $res->fetch_assoc();
    $temp = $l['naziv'];
    return $temp;
}
Ejemplo n.º 4
0
 public function unesi($tip, $aktivnost, $korisnik = "")
 {
     require_once 'baza.class.php';
     require_once 'pomak.php';
     $virtualnovrijeme = virtualnovrijeme();
     if (!isset($baza)) {
         $baza = new baza();
     }
     $ip = $_SERVER['REMOTE_ADDR'];
     $upit = "INSERT INTO dnevnik (`korisnik`,`vrijeme`,`akcija`,`ip_adresa`,`tip`) VALUES ('{$korisnik}','{$virtualnovrijeme}','{$aktivnost}', '{$ip}', '{$tip}');";
     $res = $baza->selectUpit($upit, false);
 }
Ejemplo n.º 5
0
function rute($id)
{
    require_once 'baza.class.php';
    $baza = new baza();
    $out = "";
    $upit = "SELECT * FROM rute_has_mjesta rhm LEFT JOIN mjesta m ON (rhm.mjesta_idmjesta=m.idmjesta) WHERE rhm.rute_idrute={$id} ORDER BY rhm.redosljed ASC";
    $podaci = $baza->selectUpit($upit);
    $tmp = array();
    while ($l = $podaci->fetch_array()) {
        $tmp[] = $l['naziv_mjesta'];
    }
    if (count($tmp) > 0) {
        $out = implode(' - ', $tmp);
    }
    return $out;
}
Ejemplo n.º 6
0
function postari_u_sluzbi($idks)
{
    $out = "Nema dodjeljenog poštara";
    require_once 'baza.class.php';
    $baza = new baza();
    $upit = "SELECT * FROM korisnici WHERE role_idrole=2 AND idkurirske_sluzbe={$idks}";
    $podaci = $baza->selectUpit($upit);
    $tmp = array();
    while ($l = $podaci->fetch_array()) {
        $tmp[] = $l['ime_prezime'];
    }
    if (!empty($tmp)) {
        $out = implode(", ", $tmp);
    }
    return $out;
}
Ejemplo n.º 7
0
 private function sendNotification()
 {
     include_once 'baza.class.php';
     $baza = new baza();
     $baza->spojiDB();
     $registatoin_ids = array();
     $sql = "SELECT * FROM Air";
     $result = $baza->selectUpit($sql);
     while ($row = mysqli_fetch_assoc($result)) {
         array_push($registatoin_ids, $row['registration_id']);
     }
     // Set POST variables
     $url = 'https://android.googleapis.com/gcm/send';
     $json_data = file_get_contents('simulations.json');
     $json = json_decode($json_data, true);
     $message = array();
     //$message = array("Notice" => $_POST['message']);
     $i = 0;
     foreach ($json as $key => $value) {
         $message["name" . $i] = "" . $value['name'] . ";" . $value['percentage'] . ";" . $value['longitude'] . ";" . $value['latitude'] . ";";
         $i += 1;
     }
     $fields = array('registration_ids' => $registatoin_ids, 'data' => $message);
     //echo $fields['data'];
     $headers = array('Authorization: key=AIzaSyDw1dJ7G9c03mxM3qGsrEfBtOK1jCy9f_M', 'Content-Type: application/json');
     //echo $message;
     // Open connection
     $ch = curl_init();
     // Set the url, number of POST vars, POST data
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     // Disabling SSL Certificate support temporarly
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
     // Execute post
     $result = curl_exec($ch);
     if ($result === FALSE) {
         die('Curl failed: ' . curl_error($ch));
     }
     // Close connection
     curl_close($ch);
 }
Ejemplo n.º 8
0
		 </thead>
		  <tbody>
		  <?php 
    $dodatak = "";
    if (!empty($_POST['od']) && !empty($_POST['do'])) {
        $dodatak .= " AND z.datum BETWEEN '" . date("Y-m-d H:i:s", strtotime($_POST['od'] . ":00")) . "' AND '" . date("Y-m-d H:i:s", strtotime($_POST['do'] . ":00")) . "'";
    } else {
        if (!empty($_POST['od'])) {
            $dodatak .= " AND z.datum > '" . date("Y-m-d H:i:s", strtotime($_POST['od'])) . "'";
        }
        if (!empty($_POST['do'])) {
            $dodatak .= " AND z.datum < '" . date("Y-m-d H:i:s", strtotime($_POST['do'])) . "'";
        }
    }
    $upit = "SELECT count(*) as 'Broj poslanih paketa',ime_prezime as 'Ime i prezime',korisnicko_ime as 'Korisnicko ime' from zahtjevi z  left join kurirske_sluzbe ks on(z.idkurirske_sluzbe=ks.idkurirske_sluzbe) left join korisnici k on(z.posiljatelj=k.korisnicko_ime) WHERE 1=1 and z.idkurirske_sluzbe={$idkurirske} " . $dodatak . " group by posiljatelj order by count(*) desc";
    $podaci = $baza->selectUpit($upit, false);
    while ($l = $podaci->fetch_array()) {
        echo "<tr>\r\n\t\t\t\t \r\n\t\t\t\t\r\n\t\t\t\t<td>" . $l['Broj poslanih paketa'] . "</td>\t \r\n\t\t\t\t<td>" . $l['Ime i prezime'] . "</td>\r\n                                    <td>" . $l['Korisnicko ime'] . "</td>\r\n\t\t\t\t\r\n\t\t\t\t \r\n\t\t\t</tr>";
    }
    echo "</tbody>";
    echo "</table>";
    ?>
                      <button id="btnprint" onClick="window.print();" type="button" class="btn"><span class="glyphicon glyphicon-print"></span>&nbsp;Ispis</button><br><br>
                <form method="POST">
			<input type="hidden" name="pdf" value=1/>
			<input type="hidden" name="ispis" value="<?php 
    echo base64_encode(serialize($ispis));
    ?>
"/>
			<button id="btnpdf" type="submit" class="btn"><span class="glyphicon glyphicon-file"></span>&nbsp;Izradi PDF</button>
			</form>
Ejemplo n.º 9
0
     $kur = isset($_POST['kur']) ? $_POST['kur'] : false;
     $email = isset($_POST['email']) ? $_POST['email'] : false;
     if ($kur && $email) {
         $upit = "INSERT INTO Djelatinici VALUES ('{$kur}','{$email}',1)";
         $baza->ostaliUpiti($upit);
         if (!isset($_SESSION)) {
             session_start();
         }
         Baza_Radnje(addslashes($upit), $_SESSION['email'], 1);
         Baza_Radnje("Dodijeljen postar {$kur}, Kurirskoj sluzbi s ID: {$email} ...", $_SESSION['email'], 2);
     }
     //ako su dospjeli podaci koga treba dodati kome
 }
 //ako se radi od dodavanju
 $upit = "Select Kur_sluzba.naziv AS Naziv,Kur_sluzba.id_kur AS ID from Kur_sluzba";
 $podaci = $baza->selectUpit($upit);
 $i = 0;
 while ($red = $podaci->fetch_array()) {
     $response[$i]['Naziv'] = $red['Naziv'];
     $response[$i]['ID'] = $red['ID'];
     $i = $i + 1;
 }
 //while
 $upit_2 = "Select DISTINCT Korisnik.email as EMAIL from Korisnik where NOT EXISTS (Select Djelatinici.id_kor FROM Djelatinici WHERE Djelatinici.id_kor = Korisnik.email) AND Korisnik.status=3 ";
 $podaci_2 = $baza->selectUpit($upit_2);
 $j = 0;
 while ($red_2 = $podaci_2->fetch_array()) {
     $response[$j]['EMAIL'] = $red_2['EMAIL'];
     $j = $j + 1;
 }
 //while
Ejemplo n.º 10
0
$baza = new baza();
$baza->spojiDB();
$smarty = new Smarty();
if (!isset($_SESSION)) {
    session_start();
}
if ($_SESSION['status']) {
    $prenesi = '';
    if ($_SESSION['status'] == 4) {
        $prenesi .= "\n        <li class='dropdown'>\n        <a href='#' class='dropdown-toggle' data-toggle='dropdown'><strong>Registrirani korisnik </strong> <b class='caret'></b></a>\n        <ul class='dropdown-menu'>\n          <li id='klik_spaket'><a href='#'>Slanje paketa</a></li>\n          <li id='klik_scruta'><a href='#'>Cijena Ruta</a></li>\n          <li id='stat_kur' data-table='STATKUR' data-name='Broj'><a href='#'>Statistika kurirskih sluzbi</a></li>\n          <li id='stat_rute' data-table='STATRUT' data-name='Broj'><a href='#'>Statistika ruta</a></li>\n\n        </ul>\n      </li>\n      <li class='dropdown'>\n        <a href='#' class='dropdown-toggle' data-toggle='dropdown'><strong>Moderator </strong> <b class='caret'></b></a>\n        <ul class='dropdown-menu'>\n          <li id='klik_tablicee'><a href='#'>Određivanje dostavnih lokacija</a></li>\n          <li id='klik_tablicee'><a href='#'>Definiranje rute</a></li>\n          <li id='klik_tablicee'><a href='#'>Preuzmi paket</a></li>\n          <li id='klik_tablicee'><a href='#'>Azuriraj paket</a></li>\n          <li id='klik_gal_slik' data-gal='10'><a href='#'>Galerija slika</a></li>\n          <li id='stat_mod1' data-table='modstat1' data-name='Broj'><a href='#'>Statistika</a></li>\n          \n        </ul>\n      </li>\n        <li class='dropdown'>\n        <a href='#' class='dropdown-toggle' data-toggle='dropdown'><strong>Administrator</strong> <b class='caret'></b></a>\n        <ul class='dropdown-menu'>\n          <li id='klik_config'><a href='#'>Konfiguracija sustava</a></li>\n          <li id='klik_blok_kor'><a href='#'>Otkljucavanje/blokiranje</a></li>\n          <li id='klik_dnevnikr'><a href='#'>Dnevnik radnji i baze</a></li>\n          <li id='klik_dnevnikp'><a href='#'>Dnevnik prijave i odjave</a></li>\n          <li id='klik_tablicee'><a href='#'>CRUD</a></li>\n          <li id='klik_dodjela'><a href='#'>Dodijeli postara</a></li>\n          <li id='klik_mailslanje' data-table='GENMAIL'><a href='#'>Slanje notifikacijskog</a></li>\n          <li id='statadmin' data-table='adminstat' data-name='Ukupno'><a href='#'>Statistika</a></li>\n        </ul>\n      </li>";
        //dodajemo menije
    }
    if ($_SESSION['status'] == 3) {
        $prenesi .= "\n        <li class='dropdown'>\n        <a href='#' class='dropdown-toggle' data-toggle='dropdown'><strong>Registrirani korisnik </strong> <b class='caret'></b></a>\n        <ul class='dropdown-menu'>\n          <li id='klik_spaket'><a href='#'>Slanje paketa</a></li>\n          <li id='klik_scruta'><a href='#'>Cijena Ruta</a></li>\n          <li id='stat_kur' data-table='STATKUR' data-name='Broj'><a href='#'>Statistika kurirskih sluzbi</a></li>\n          <li id='stat_rute' data-table='STATRUT' data-name='Broj'><a href='#'>Statistika ruta</a></li>\n\n        </ul>\n      </li>\n      <li class='dropdown'>\n        <a href='#' class='dropdown-toggle' data-toggle='dropdown'><strong>Moderator </strong> <b class='caret'></b></a>\n        <ul class='dropdown-menu'>";
        $upit = "Select status from Djelatinici where id_kor = '" . $_SESSION['email'] . "'";
        $odg = $baza->selectUpit($upit);
        if ($nesto = $odg->fetch_array()) {
            if ($nesto['status'] == 1) {
                $prenesi .= "<li id='klik_sdostave'><a href='#'>Određivanje dostavnih lokacija</a></li>";
                $prenesi .= "<li id='klik_defrute'><a href='#'>Definiranje rute</a></li>";
                $prenesi .= "<li id='klik_preuzmi'><a href='#'>Preuzmi paket</a></li>";
                $prenesi .= "<li id='klik_azuriraj'><a href='#'>Ažuriraj paket</a></li>";
                $prenesi .= "<li id='klik_gal_slik' data-gal='10'><a href='#'>Galerija slika</a></li>";
                $prenesi .= "<li id='stat_mod1' data-table='modstat1' data-name='Broj'><a href='#'>Statistika</a></li>";
            } else {
                $prenesi .= "<li><a href='#'>Nemate dodijeljenu sluzbu</a></li>";
            }
        } else {
            $prenesi .= "<li><a href='#'>Nemate dodijeljenu sluzbu</a></li>";
        }
        $prenesi .= "</ul>\n      </li>";
Ejemplo n.º 11
0
if (isset($_POST['registracija'])) {
    //dohvaćanje korisnikovih podataka iz forme i spremanje u varijable
    $korisnici_ime = $_POST['ime'];
    $korisnici_prezime = $_POST['prezime'];
    $korisnici_adresa = $_POST['adresa'];
    $korisnici_grad = $_POST['grad'];
    $korisnici_email = $_POST['email'];
    $korisnici_korisnickoime = $_POST['korisnickoime'];
    $korisnici_lozinka = $_POST['lozinka'];
    $korisnici_lozinka1 = $_POST['potvrda'];
    $korisnici_obavijesti = $_POST['primaj'];
    $lozinkahash = md5($korisnici_lozinka);
    $aktkod = md5($korisnici_korisnickoime . time());
    $poruka = "";
    $upit = "SELECT * FROM korisnici WHERE korisnicko_ime = '{$korisnici_korisnickoime}' LIMIT 1";
    $res = $baza->selectUpit($upit);
    //provjera recaptche
    require_once 'recaptcha/recaptchalib.php';
    $privatekey = "6Le5xvISAAAAAJ8OJZOfXk1_moWU62AIg4sT8jvH";
    $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
    if (!$resp->is_valid) {
        $poruka .= "Kriva captcha.<br />";
        header("Location: greske.php?idGreske=19");
    } else {
    }
    //provjera podudarnosti lozinki
    if (strcmp($korisnici_lozinka, $korisnici_lozinka1) != 0) {
        $poruka .= "Lozinke nisu jednake.<br />";
        header("Location: greske.php?idGreske=9");
    }
    //provjera da li lozinka sadrzi minimalno 6 znakova
Ejemplo n.º 12
0
    $pdf->AddPage();
    //First table: put all columns automatically
    if ($stat == 1) {
        $pdf->Table('select ks.naziv_sluzbe as Naziv ,count(*) as Broj from zahtjevi z left join kurirske_sluzbe ks on(z.idkurirske_sluzbe=ks.idkurirske_sluzbe) group by z.idkurirske_sluzbe order by count(*) desc ');
    }
    if ($stat == 2) {
        $pdf->Table('select rute_idrute as IDrute,count(*) as Broj from paketi p left join rute r on(p.rute_idrute=r.idrute) where p.rute_idrute is not null group by r.idrute ');
    }
    $pdf->Output();
}
include "header.php";
include "izbornik.php";
require_once 'baza.class.php';
$baza = new baza();
$upit = "select ks.naziv_sluzbe ,count(*) as broj from zahtjevi z left join kurirske_sluzbe ks on(z.idkurirske_sluzbe=ks.idkurirske_sluzbe) group by z.idkurirske_sluzbe order by count(*) desc limit 5";
$podaci = $baza->selectUpit($upit);
$xml = new SimpleXMLElement('<chart/>');
$item = $xml->addChild('categories');
while ($l = $podaci->fetch_array()) {
    $item->addChild('item', $l['naziv_sluzbe']);
    $item1 = $xml->addChild('series');
    $item1->addChild('name', $l['naziv_sluzbe']);
    $item2 = $item1->addChild('data');
    $item2->addChild('point', $l['broj']);
}
$fp = fopen("podaci/proba1.xml", "wb");
fwrite($fp, $xml->asXML());
fclose($fp);
$upit = "select count(*) as broj,rute_idrute from paketi p left join rute r on(p.rute_idrute=r.idrute) where p.rute_idrute is not null group by r.idrute order by count(*) desc limit 5";
$podaci = $baza->selectUpit($upit);
$xml = new SimpleXMLElement('<chart/>');
Ejemplo n.º 13
0
ob_start();
if (!isset($_SESSION)) {
    session_start();
}
include_once 'baza.class.php';
include_once 'greske.php';
$baza = new baza();
$baza->spojiDB();
if (isset($_POST['buton_paket'])) {
    $primatelj_email = $_POST['primatelj_paketa'] ? $_POST['primatelj_paketa'] : false;
    $adresa_odred_paketa = $_POST['adresa_odred_paketa'] ? $_POST['adresa_odred_paketa'] : false;
    $grad_odred_paketa = $_POST['grad_odred_paketa'] ? $_POST['grad_odred_paketa'] : false;
    $tip_dostave = $_POST['dostava_odred_paketa'] ? $_POST['dostava_odred_paketa'] : false;
    $kur_odred_paketa = $_POST['kur_odred_paketa'] ? $_POST['kur_odred_paketa'] : false;
    $upit_broj = "Select COUNT(*)id_paket from Paket";
    $podaci = $baza->selectUpit($upit_broj);
    $red = $podaci->fetch_array();
    $id_nex = $red['id_paket'];
    $id_next = $id_nex + 1;
    $upit_gal = 'Insert into Gal_slik values(' . $id_next . ',"' . $id_next . '_img1.jpg","' . $id_next . '_img2.jpg","' . $id_next . '_img3.jpg")';
    $baza->ostaliUpiti($upit_gal);
    $upit_paket = 'Insert into Paket (id_paket,id_kurs,id_topd,naziv,adresa_prim,grad_prim,adresa_pos,grad_pos,gal_slik) values (' . $id_next . ',' . $kur_odred_paketa . ',' . $tip_dostave . ',"naziv_' . $id_next . '","' . $adresa_odred_paketa . '","' . $grad_odred_paketa . '","' . $_SESSION['adresa'] . '","' . $_SESSION['grad'] . '",' . $id_next . ')';
    $baza->ostaliUpiti($upit_paket);
    $upit_pos = 'Insert into Sudionici values ("' . $_SESSION['email'] . '",' . $id_next . ',1)';
    $baza->ostaliUpiti($upit_pos);
    $upit_prim = "Insert into Sudionici values ((Select email from Korisnik where email='{$primatelj_email}' OR kor_ime='{$primatelj_email}'),{$id_next},2)";
    $baza->ostaliUpiti($upit_prim);
    $vrime = vratiVrime();
    $upit_status = 'Insert into Paketi_status (paket_id_paket,datum_postavljanja,status) values (' . $id_next . ',"' . $vrime . '",1)';
    $baza->ostaliUpiti($upit_status);
    Baza_Radnje("Kreiran paket primatelj: {$primatelj_email}", $_SESSION['email'], 2);
Ejemplo n.º 14
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
ob_start();
include_once 'baza.class.php';
include_once 'greske.php';
$baza = new baza();
$baza->spojiDB();
$kor = $_GET["kor_mail"];
$act = $_GET["act"];
$upit = "select Korisnik.datum_reg,Korisnik.status from Korisnik where Korisnik.email = '{$kor}' AND Korisnik.aktivacija = '{$act}'";
if ($tdat = $baza->selectUpit($upit)) {
    $red = $tdat->fetch_array();
    $datum_reg = $red['datum_reg'];
    //datum registracije korisinika sa kliknutim aktivacijskim linkom
    $status = $red['status'];
    //status provjeravmo zbog dodatne provjere
    if ($status == 0) {
        if (strtotime('-1 day') < strtotime($datum_reg) && strtotime('+1 day') > strtotime($datum_reg)) {
            //pretvaramo u unixov format za vrijeme i usporedujemo da vidimo dali je prosao jedan dan
            $upit = "UPDATE Korisnik SET status=2 WHERE Korisnik.email = '{$kor}' AND Korisnik.aktivacija = '{$act}'";
            //upit s kojim mjenjamo status
            if ($baza->ostaliUpiti($upit)) {
                Baza_Radnje("Uspjesna aktivacija", $kor, 2);
                header("Location: pocetna.php");
                exit;
            }