function get_training_duration($a) { $db = new baza(); $db->connect(); if ($db->dbhandle === NULL) { echo 'Napaka pri povezavi z bazo<BR>'; exit(1); } //BUG previous week does not work if current week is 1! //$a=$_GET['previous']; //individual training; if ($a == 0) { $query = "select start_time as order_time, to_char(start_time,'DD.MM HH24:MI Dy') as start_time,avg_hr, max_hr,calories,extract(hours from time_in_zone_1*60) as z1,extract(hours from time_in_zone_2*60) as z2, extract(hours from time_in_zone_3*60) as z3, extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*60) as nozone, time_in_zone_1, time_in_zone_2, time_in_zone_3,duration-time_in_zone_1-time_in_zone_2-time_in_zone_3 as time_in_nozone from training order by order_time;"; } elseif ($a == 1) { //training/day $query = "select to_char(date(start_time),'Dy DD.MM') as start_time, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*60)) as z1,sum(extract(hours from time_in_zone_2*60)) as z2, sum(extract(hours from time_in_zone_3*60)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*60)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by date(start_time) order by date(start_time);"; } else { //training/week $query = "select extract(week from start_time) as start_time, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*60)) as z1,sum(extract(hours from time_in_zone_2*60)) as z2, sum(extract(hours from time_in_zone_3*60)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*60)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by extract(week from start_time) order by extract(week from start_time);"; } $db->query($query); $arr = array(); $estcal = 0; for ($i = 0; $i < $db->rows; $i++) { $db->getrow(NULL); $estcal = 0; $estcal = $estcal + (-95.7735 + 0.634 * 123 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z1'] / 60; $estcal = $estcal + (-95.7735 + 0.634 * 140 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z2'] / 60; $estcal = $estcal + (-95.7735 + 0.634 * 158 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z3'] / 60; array_push($arr, array($db->crow['start_time'], intval($db->crow['nozone']), $db->crow['time_in_nozone'], intval($db->crow['z1']), $db->crow['time_in_zone_1'], intval($db->crow['z2']), $db->crow['time_in_zone_2'], intval($db->crow['z3']), $db->crow['time_in_zone_3'], intval($db->crow['avg_hr']), intval($db->crow['max_hr']), intval($db->crow['calories']), $estcal)); } #$arr=array (array('Zone 1 (60%-70%) MaxHR',intval($db->crow['z1'])),array('Zone 2 (70%-80%) MaxHR',intval($db->crow['z2'])), array('Zone 3 (80%-90%) MaxHR',intval($db->crow['z3'])),array('Out of zone',intval($db->crow['nozone']))); $db->close(); echo json_encode($arr); }
function get_training_load($a) { $db = new baza(); $db->connect(); if ($db->dbhandle === NULL) { echo 'Napaka pri povezavi z bazo<BR>'; exit(1); } //BUG previous week does not work if current week is 1! //$a=$_GET['previous']; if ($a == 0) { $query = "select to_char(start_time,'DD.MM HH24:MI Dy') as start_time,avg_hr, max_hr,calories,extract(hours from time_in_zone_1*3600) as z1,extract(hours from time_in_zone_2*3600) as z2, extract(hours from time_in_zone_3*3600) as z3, extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600) as nozone, time_in_zone_1, time_in_zone_2, time_in_zone_3,duration-time_in_zone_1-time_in_zone_2-time_in_zone_3 as time_in_nozone from training order by start_time;"; } elseif ($a == 1) { $query = "select to_char(date(start_time),'Dy DD.MM') as start_time, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*3600)) as z1,sum(extract(hours from time_in_zone_2*3600)) as z2, sum(extract(hours from time_in_zone_3*3600)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by date(start_time) order by date(start_time);"; } else { $query = "select extract(week from start_time) as start_time, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*3600)) as z1,sum(extract(hours from time_in_zone_2*3600)) as z2, sum(extract(hours from time_in_zone_3*3600)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by extract(week from start_time) order by extract(week from start_time);"; } $db->query($query); $arr = array(); for ($i = 0; $i < $db->rows; $i++) { $db->getrow(NULL); $estcal = 0; $estcal = $estcal + (-95.7735 + 0.634 * 123 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z1'] / 3600; $estcal = $estcal + (-95.7735 + 0.634 * 140 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z2'] / 3600; $estcal = $estcal + (-95.7735 + 0.634 * 158 + 0.404 * 54 + 0.394 * 85 + 0.271 * 31) / 4.184 * 60 * $db->crow['z3'] / 3600; //$load=1.62*$db->crow['z1']/60+2.12*$db->crow['z2']/60+3.16*$db->crow['z3']/60; $load = 1.5 * $db->crow['z1'] / 60 + 2.15 * $db->crow['z2'] / 60 + 3.1 * $db->crow['z3'] / 60; array_push($arr, array($db->crow['start_time'], $load, intval($db->crow['calories']), $estcal)); } $db->close(); echo json_encode($arr); }
/** * Inicjalizuje stronę glówną i wyświetla statystykę z bazy danych * @return view */ function index() { $temp = new baza(); $this->layout->header = 'Witaj!'; $this->layout->content = $temp->statystyka(); return $this->layout; }
function Baza_Radnje($opis, $email, $tip) { $baza = new baza(); $baza->spojiDB(); $vrime = vratiVrime(); $upit = "Insert into Radnje_baza (id_baza,id_kor,datum_rada,opis,tip) values ('default','{$email}','{$vrime}','{$opis}','{$tip}' )"; $baza->ostaliUpiti($upit); }
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']; }
function get_training_loadcurve($a) { $db = new baza(); $db->connect(); if ($db->dbhandle === NULL) { echo 'Napaka pri povezavi z bazo<BR>'; exit(1); } //BUG previous week does not work if current week is 1! //$a=$_GET['previous']; if ($a == 0) { $query = "select to_char(start_time,'DD.MM HH24:MI Dy') as start_time, extract(epoch from start_time) as epoch_start,avg_hr, max_hr,calories,extract(hours from time_in_zone_1*3600) as z1,extract(hours from time_in_zone_2*3600) as z2, extract(hours from time_in_zone_3*3600) as z3, extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600) as nozone, time_in_zone_1, time_in_zone_2, time_in_zone_3,duration-time_in_zone_1-time_in_zone_2-time_in_zone_3 as time_in_nozone from training order by start_time;"; } elseif ($a == 1) { $query = "select to_char(date(start_time),'Dy DD.MM') as start_time, extract(epoch from start_time) as epoch_start, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*3600)) as z1,sum(extract(hours from time_in_zone_2*3600)) as z2, sum(extract(hours from time_in_zone_3*3600)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by date(start_time) order by date(start_time);"; } else { $query = "select extract(week from start_time) as start_time, avg(avg_hr)::integer as avg_hr, max(max_hr) as max_hr ,sum(calories) as calories,sum(extract(hours from time_in_zone_1*3600)) as z1,sum(extract(hours from time_in_zone_2*3600)) as z2, sum(extract(hours from time_in_zone_3*3600)) as z3, sum(extract(hours from (duration-time_in_zone_1-time_in_zone_2-time_in_zone_3)*3600)) as nozone, sum(time_in_zone_1) as time_in_zone_1, sum(time_in_zone_2) as time_in_zone_2, sum(time_in_zone_3) as time_in_zone_3,sum(duration-time_in_zone_1-time_in_zone_2-time_in_zone_3) as time_in_nozone from training group by extract(week from start_time) order by extract(week from start_time);"; } $db->query($query); $tarr = array(); $total_idx = $db->rows - 1; for ($i = 0; $i < $db->rows; $i++) { $db->getrow(NULL); $load = 1.5 * $db->crow['z1'] / 60 + 2.15 * $db->crow['z2'] / 60 + 3.1 * $db->crow['z3'] / 60; array_push($tarr, array($db->crow['epoch_start'], $load)); } $factor = -4.5113E-6; #$factor=-4.0113E-6; $now = $tarr[$total_idx][0]; for ($i = 0; $i < 101; $i++) { $loadcurve[$i] = 0; $timeline[$i] = $tarr[0][0] + $i * ($now - $tarr[0][0]) / 100; } for ($j = 0; $j < $total_idx; $j++) { $sttime = 0; $k = 0; for ($i = $tarr[0][0]; $i < $now; $i = $i + ($now - $tarr[0][0]) / 100) { if ($i >= $tarr[$j][0]) { if ($sttime == 0) { $sttime = $i; } $loadcurve[$k] = $loadcurve[$k] + $tarr[$j][1] * exp($factor * ($i - $sttime)); // echo $i-$sttime; } $k++; } } //echo $tarr[0][0]; $arr = array(); for ($i = 0; $i < 101; $i++) { array_push($arr, array(date('d.m.Y', $timeline[$i]), $loadcurve[$i])); } echo json_encode($arr); //array_push($arr,array($db->crow['start_time'],$load,intval($db->crow['calories']),$estcal)); $db->close(); //echo json_encode($arr); }
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']; }
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; }
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); }
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; }
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; }
function unesi($i, $o, $c) { include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); //upper case first $i = ucfirst($i); $o = ucfirst($o); //dal ima greske if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } $query = "INSERT INTO tereni VALUES ('LAST_INSERT_ID()', '{$i}', '{$o}', {$c})"; $mysqli->query($query); printf("Unet je teren sa brojem: ", $mysqli->insert_id); $mysqli->close(); }
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); }
function add_zones($a) { $db = new baza(); $db->connect(); if ($db->dbhandle === NULL) { echo 'Napaka pri povezavi z bazo<BR>'; exit(1); } //BUG previous week does not work if current week is 1! //$a=$_GET['previous']; $query = "select extract(hours from sum(time_in_zone_1*3600)) as z1, extract(hours from sum(time_in_zone_2*3600)) as z2, extract(hours from sum(time_in_zone_3*3600)) as z3,extract(hours from (sum(duration)- (sum(time_in_zone_2)+sum(time_in_zone_1)+ sum(time_in_zone_3)))*3600) as nozone from training where EXTRACT(WEEK FROM start_time)=EXTRACT(WEEK FROM now())-{$a};"; if ($a < 0) { $query = "select extract(hours from sum(time_in_zone_1*3600)) as z1, extract(hours from sum(time_in_zone_2*3600)) as z2, extract(hours from sum(time_in_zone_3*3600)) as z3, extract(hours from (sum(duration)- (sum(time_in_zone_2)+sum(time_in_zone_1)+ sum(time_in_zone_3)))*3600) as nozone from training;"; } $db->query($query); $db->getrow(NULL); //$arr=array (array('Zone 1',1),array('Zone 2',2), array('Zone 3',3)); $arr = array(array('Zone 1 (60%-70%) MaxHR', intval($db->crow['z1'])), array('Zone 2 (70%-80%) MaxHR', intval($db->crow['z2'])), array('Zone 3 (80%-90%) MaxHR', intval($db->crow['z3'])), array('Out of zone', intval($db->crow['nozone']))); $db->close(); echo json_encode($arr); }
function ucitajTerene() { if (isset($_GET['ord'])) { $order = $_GET['ord']; } else { $order = ""; } include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); echo '<table class="table table-hover table-condensed table-bordered" id="levaX">'; echo '<tr class="active"><th>Broj terena</th><th>Naziv</th><th>Opština</th><th>Cena</th>'; // $order = "cena_termina"; if ($order === "") { $query = "SELECT * FROM tereni"; } else { if ($order === "cena_termina") { $query = "SELECT * FROM tereni ORDER BY {$order} DESC"; } else { $query = "SELECT * FROM tereni ORDER BY {$order} ASC"; } } $result = $mysqli->query($query); $i = 1; while ($row = $result->fetch_row()) { //svaki teren svoj broj echo '<tr class="danger"><td>'; echo $i; echo '</td>'; echo '<td id="teren' . $i . '">' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td data-type="text" data-placement="right" data-title="Enter username" id="cenaX' . $i . '">' . $row[3] . '</td>'; $i++; } echo "</table>"; }
session_start(); if (empty($_SESSION['korisnicko_ime'])) { die("Niste logirani"); } require_once "korisnici.class.php"; $k = new korisnici(); $tmp = $k->uloga($_SESSION['korisnicko_ime']); $rola = $tmp[1]; $idrole = $tmp[0]; if ($idrole != 3) { die("Nemate pravo pristupa"); } include "header.php"; include "izbornik.php"; require_once 'baza.class.php'; $baza = new baza(); //promijeni korisnici if (isset($_POST['promijeni'])) { $upit = "UPDATE korisnici SET ime_prezime = '{$_POST['ip']}', adresa = '{$_POST['adresa']}', grad = '{$_POST['grad']}', email = '{$_POST['email']}', password = '******'lozinka']}', role_idrole = '{$_POST['rola']}', idkurirske_sluzbe = '{$_POST['sluzba']}', neuspjesne_prijave = '{$_POST['neuspjesno']}' where korisnicko_ime = '{$_POST['id']}'"; if ($baza::ostaliUpiti($upit)) { echo "Uspješna promjena podataka<br>"; echo "<a href='crud.php'><button class='btn btn-primary'>Povratak</button></a>"; exit; } } elseif (isset($_POST['promijeni1'])) { $upit = "UPDATE kurirske_sluzbe SET naziv_sluzbe = '{$_POST['naziv']}', adresa = '{$_POST['adresa']}', oib = '{$_POST['oib']}' where idkurirske_sluzbe = '{$_POST['id']}'"; if ($baza::ostaliUpiti($upit)) { echo "Uspješna promjena podataka<br>"; echo "<a href='crud.php'><button class='btn btn-primary'>Povratak</button></a>"; exit; }
<?php include_once 'baza.class.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. */ if (isset($_GET['regId'])) { $baza = new baza(); $baza->spojiDB(); $regId = $_GET['regId']; $sql = "INSERT INTO Air (registration_id) values ('{$regId}')"; $baza->ostaliUpiti($sql); }
<?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'; $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();
<div class="col-lg-12 text-center"> <h2>Rezultati takmičenja</h2> <hr class="star-primary"> </div> </div> <div class="row"> <div class="col-md-4"> <div id="levaT"> <h4><span class="label label-primary">Prva grupa</span></h4> </div> <?php include 'baza.php'; $b = new baza(); $mysqli = $b->konektuj(); $query = "SELECT * FROM zapad ORDER BY Broj_poena desc, Gem_razlika desc"; //rezultat pretrage $result = $mysqli->query($query); echo '<table class="table table-hover table-condensed table-bordered" id="leva">'; echo '<tr class="active"><th>Mesto</th><th>Takmičar</th><th>Broj mečeva</th><th>Gem razlika</th><th>Broj poena</th></tr>'; //ISPISIVANJE ZAPAD tabele $i = 1; while ($row = $result->fetch_row()) { if ($i <= 4) { echo '<tr class="danger"><td>'; echo $i; echo '</td>'; echo '<td>'; echo $row[2];
<?php ob_start(); include_once 'baza.class.php'; $baza = new baza(); $baza->spojiDB(); $name = isset($_POST['name']) ? $_POST['name'] : false; $table = isset($_POST['table']) ? $_POST['table'] : false; $order = isset($_POST['order']) ? $_POST['order'] : false; if ($name && $table && $order) { if ($table === 'hKorisnik' || $table === 'otKorisnik' || $table === 'ppKorisnik') { $table = 'Korisnik'; if ($name == "ZZ") { $name = 1; } $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);
parent::Header(); } } //Connect to database mysql_connect('localhost', 'WebDiP2013_086', 'admin_kggK'); mysql_select_db('WebDiP2013_086'); $pdf = new PDF(); $pdf->AddPage(); //First table: put all columns automatically $pdf->Table("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"); $pdf->Output(); } include "header.php"; include "izbornik.php"; require_once 'baza.class.php'; $baza = new baza(); ?> <style> @media print { #popis_info { display: none;} #popis_paginate { display: none;} #popis_filter { display: none;} #forma { display: none; } #footer_container { display: none; } #btnprint { display: none; } #btnpdf { display: none; } .navbar {display: none; } #datetimepicker8 { display: none; } #datetimepicker9 { display: none; }
<?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(); $vrsta = isset($_POST['vrsta']) ? $_POST['vrsta'] : false; if ($vrsta) { if ($vrsta == 2) { $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);
<?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(); 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)';
<?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 'greske.php'; Smarty::muteExpectedErrors(); require_once '../Smarty/libs/Smarty.class.php'; include_once 'baza.class.php'; $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>";
<?php /** * Created by PhpStorm. * User: Prima * Date: 13.06.14. * Time: 22:24 */ include_once './view/header.php'; include_once './controler/baza.class.php'; $baza = new baza(); $dataTables = "<script src=\"//cdn.datatables.net/1.10.0/js/jquery.dataTables.min.js\"></script>\n<script src=\"//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.js\"></script>"; $upit = "select d.id,d.vrijeme,d.uspjesno,d.korisnik_idkorisnik,t.naziv,d.upit from dnevnik_rada as d, tip_dogadjaja as t where t.idtip_dogadjaja=d.tip_dogadjaja order by id desc"; $rezultat = $baza->selectDB($upit); $tablica = "<div class=\"container\"><table id=\"tablica\" class=\"table table-striped table-hover\"><caption><h2><strong>Dnevnik rada</strong></h2></caption>"; $tablica .= "<thead><tr><th>ID</th><th>Vrijeme</th><th>Usjpesno</th><th>ID korisnika</th><th>Tip događaja</th><th>Upit</th></tr></thead><tbody>"; while ($red = $rezultat->fetch_row()) { $tablica .= "<tr><td>{$red['0']}</td><td>{$red['1']}</td><td>{$red['2']}</td><td>{$red['3']}</td><td>{$red['4']}</td><td>{$red['5']}</td></tr>"; } $tablica .= "</tbody></table></div>"; echo $dataTables; echo $tablica; include_once './view/footer.php'; ?> <button type="button" id="ispis" class="btn btn-warning pull-right printMe"> <i class="glyphicon glyphicon-print"></i> Ispis</button> <script src="scripts/print.js"></script>
<?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(); if (isset($_POST['posalji_opis_paketa'])) { if (count($_FILES['file']['name']) == 3) { $ruta = isset($_POST['dostupne_rute']) ? $_POST['dostupne_rute'] : false; $naziv = isset($_POST['naziv_ppaketa']) ? $_POST['naziv_ppaketa'] : false; $tezina = isset($_POST['ppaket_tezina']) ? $_POST['ppaket_tezina'] : false; $visina = isset($_POST['ppaket_visina']) ? $_POST['ppaket_visina'] : false; $sirina = isset($_POST['ppaketa_sirina']) ? $_POST['ppaketa_sirina'] : false; $duzina = isset($_POST['ppaketa_duzina']) ? $_POST['ppaketa_duzina'] : false; $id = isset($_POST['id_ppaketa']) ? $_POST['id_ppaketa'] : false; $upit = "UPDATE Paket set naziv='" . $naziv . "',tezina={$tezina},visina={$visina},sirina={$sirina},duzina={$duzina} where id_paket={$id}"; $baza->ostaliUpiti($upit); if (!isset($_SESSION)) { session_start(); } $vrime = vratiVrime(); $upit = "UPDATE Paketi_status set datum_preuzimanja='" . $vrime . "',id_rute={$ruta},status=2,id_kor='" . $_SESSION['email'] . "' where Paket_id_paket={$id} "; $baza->ostaliUpiti($upit); for ($u = 0; $u < 3; $u = $u + 1) { $path = "../img/gal/";
<?php require_once "baza.php"; $baza = new baza(); $con = $baza->konektujse(); if (@$_GET['korisnici'] == "test") { echo "<div class='novosti'> <h2>Izmjeni postojeceg korisnika</h2><table>"; $sql = "select * from korisnici"; $res = mysql_query($sql); while ($row = mysql_fetch_array($res)) { ?> <form action="admin.php" method="post"> <tr><td><?php echo $row['user']; ?> </td><td><select name="vrsta"><option><?php echo $row['tip']; ?> </option><option>SuperAdmin</option><option>Admin</option><option>Moderator</option></select></td><td><input type="hidden" name="id" value="<?php echo $row['id']; ?> "><input type="submit" name="mijenjaj_korisnika" value="Mijenjaj korisnika"></td><td><input type="submit" name="brisi_korisnika" value="Brisi korisnika"></td></tr> </form> <?php echo "</table></div>"; } } if (@$_GET['provjera']) { $username = $_GET['provjera']; $sql = "select * from clanovi where username='******'"; $res = mysql_query($sql);
<?php include 'pomak.php'; include 'baza.class.php'; include 'log.class.php'; $log = new log(); $baza = new baza(); 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 {
<?php require_once '../Smarty/libs/Smarty.class.php'; include_once '../php/baza.class.php'; include_once '../php/greske.php'; Smarty::muteExpectedErrors(); $baza = new baza(); $baza->spojiDB(); $smarty = new Smarty(); $upit = "Select kor_ime,prezime,ime,email,lozinka from Korisnik"; $podaci = $baza->selectUpit($upit); $tablica = "<div id='kont_tab' class='table-responsive'>"; $tablica .= "<table id='htkorisnici' class='table table-hover'><thead><tr><th data-name='kor_ime' data-table='hKorisnik'>Kor_ime</th><th data-name='prezime' data-table='hKorisnik'>Prezime</th><th data-name='ime' data-table='hKorisnik'>Ime</th><th data-name='email' data-table='hKorisnik'>E-mail</th><th data-name='lozinka' data-table='hKorisnik'>Lozinka</th></thead><tbody>"; while ($red = $podaci->fetch_array()) { $tablica .= "<tr><td>{$red['kor_ime']}</td><td>{$red['ime']}</td><td>{$red['prezime']}</td><td>{$red['email']}</td><td>{$red['lozinka']}</td></tr>"; } $tablica .= "</tbody></table></div>"; $smarty->assign('DODAJ', $tablica); $smarty->display('../Smarty/templates/user.tpl'); /* ispisGori(); echo $tablica; ispisDoli(); */
<?php ob_start(); include_once 'baza.class.php'; include_once 'greske.php'; $baza = new baza(); $baza->spojiDB(); if (isset($_POST['buton_klik'])) { $prolazi = true; foreach ($_POST as $kljuc => $vrijednost) { if (empty($vrijednost)) { trigger_error("Niste unijeli sve podatke! Napomena registracija mora biti u potpunosti popunjena!", E_USER_ERROR); $prolazi = false; } } $ime = $_POST['register_ime']; $prez = $_POST['register_prezime']; $adresa = $_POST['register_adresa']; $grad = $_POST['register_grad']; $email = $_POST['register_email']; $kor_ime = $_POST['register_kor_ime']; $lozinka = $_POST['register_password']; $pon_lozinka = $_POST['re_register_password']; $broj = $_POST['register_broj']; $date = $_POST['register_datum_rod']; $spol = $_POST['register_spol']; $posta = $_POST['register_obavijesti']; if (!(ucfirst($ime) === $ime)) { trigger_error("Ime mora započetni velikim slovom!", E_USER_ERROR); $prolazi = false; }