From 1759082dc19c56a202be7343c53fee01f77b2149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0ev=C4=8D=C3=ADk?= Date: Sun, 29 Dec 2013 11:57:13 +0100 Subject: [PATCH] Used MySQLi extension instead of old MySQL. For future compatibility with new PHP versions. --- app/index.php | 6 +- app/mobile.php | 28 ++++----- app/scripts/ajax/drive-touto-dobou.php | 4 +- app/scripts/ajax/pocet-mereni.php | 4 +- app/scripts/ajax/teplota.php | 8 +-- app/scripts/db.php | 12 ++-- app/scripts/dopocitat.php | 60 +++++++++---------- app/scripts/fce.php | 8 +-- app/scripts/grafy/kombinovane/24-hodin.php | 4 +- app/scripts/grafy/kombinovane/3-dny.php | 4 +- app/scripts/grafy/kombinovane/4-hodiny.php | 4 +- app/scripts/grafy/teplota/24-hodin-mobile.php | 4 +- app/scripts/grafy/teplota/24-hodin.php | 4 +- app/scripts/grafy/teplota/3-dny.php | 4 +- app/scripts/grafy/teplota/31-dni.php | 4 +- app/scripts/grafy/teplota/4-hodiny.php | 4 +- app/scripts/grafy/teplota/historie.php | 4 +- app/scripts/grafy/teplota/mesicni.php | 4 +- app/scripts/grafy/teplota/rocni.php | 4 +- app/scripts/grafy/vlhkost/24-hodin-mobile.php | 4 +- app/scripts/grafy/vlhkost/3-dny.php | 4 +- app/scripts/grafy/vlhkost/31-dni.php | 4 +- app/scripts/grafy/vlhkost/4-hodiny.php | 4 +- app/scripts/grafy/vlhkost/historie.php | 4 +- app/scripts/grafy/vlhkost/mesicni.php | 4 +- app/scripts/grafy/vlhkost/rocni.php | 6 +- app/scripts/head.php | 4 +- app/scripts/initIndex.php | 20 +++---- app/scripts/modals/driveToutoDobou.php | 4 +- app/scripts/modals/mesicniStatistiky.php | 30 +++++----- app/scripts/modals/nejTeploty.php | 24 ++++---- app/scripts/modals/pocetMereni.php | 8 +-- app/scripts/modals/teplotyZaPosledniDny.php | 4 +- app/scripts/modals/vDobu.php | 16 ++--- app/scripts/modals/vlhkostZaPosledniDny.php | 4 +- app/scripts/tabs/aktualne.php | 12 ++-- app/scripts/tabs/denni-statistiky.php | 26 ++++---- app/scripts/tabs/historie.php | 10 ++-- app/scripts/tabs/mesicni-statistiky.php | 32 +++++----- app/scripts/tabs/rocni-statistiky.php | 50 ++++++++-------- app/vstup-MikroTik.php | 8 +-- app/vystup-XML.php | 20 +++---- app/vystup.php | 4 +- 43 files changed, 240 insertions(+), 240 deletions(-) diff --git a/app/index.php b/app/index.php index 6ceec58..1d2cc70 100644 --- a/app/index.php +++ b/app/index.php @@ -62,13 +62,13 @@ // kontrolujeme IP a sedi if(isset($ip) AND $ip != "" AND $ip == $_SERVER['REMOTE_ADDR']) { - MySQL_query("INSERT INTO tme(kdy, teplota, vlhkost) VALUES(now(), '{$teplota}', {$vlhkost})"); + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme(kdy, teplota, vlhkost) VALUES(now(), '{$teplota}', {$vlhkost})"); } // nekontrolujeme IP elseif($ip == "") { - MySQL_query("INSERT INTO tme(kdy, teplota, vlhkost) VALUES(now(), '{$teplota}', {$vlhkost})"); - print mysql_error(); + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme(kdy, teplota, vlhkost) VALUES(now(), '{$teplota}', {$vlhkost})"); + print mysqli_error($GLOBALS["DBC"]); } // problem? zrejme pozadavek z jine nez z povolene IP else diff --git a/app/mobile.php b/app/mobile.php index f48e62c..d231f08 100644 --- a/app/mobile.php +++ b/app/mobile.php @@ -35,16 +35,16 @@
@@ -94,12 +94,12 @@ for($a = 0; $a < count($dny2); $a++) { - $dotaz = MySQL_query("SELECT kdy, teplota + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme WHERE kdy >= CAST('".substr($dny2[$a], 0, 14)."0' AS datetime) AND kdy <= CAST('".substr($dny2[$a], 0, 14)."9' AS datetime) LIMIT 1"); - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); echo "
  • ".formatDnu($dny2[$a])."

    @@ -111,23 +111,23 @@ // MIN/AVG/MAX za dnesni den // Data pro mereni z dneska // Dnes nejnizsi namerena teplota/vlhkost - $dotaz = MySQL_query("SELECT MIN(teplota) as teplota, MIN(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT MIN(teplota) as teplota, MIN(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $nejnizsiDnes = MySQL_fetch_assoc($dotaz); + $nejnizsiDnes = MySQLi_fetch_assoc($dotaz); // Dnes prumerna teplota/vlhkost - $dotaz = MySQL_query("SELECT AVG(teplota) as teplota, AVG(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT AVG(teplota) as teplota, AVG(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $prumernaDnes = MySQL_fetch_assoc($dotaz); + $prumernaDnes = MySQLi_fetch_assoc($dotaz); // Dnes nejvyssi namerena teplota/vlhkost - $dotaz = MySQL_query("SELECT MAX(teplota) as teplota, MAX(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT MAX(teplota) as teplota, MAX(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $nejvyssiDnes = MySQL_fetch_assoc($dotaz); + $nejvyssiDnes = MySQLi_fetch_assoc($dotaz); echo "
  • {$lang['dnes']}
  • "; diff --git a/app/scripts/ajax/drive-touto-dobou.php b/app/scripts/ajax/drive-touto-dobou.php index ef58123..aca34a4 100644 --- a/app/scripts/ajax/drive-touto-dobou.php +++ b/app/scripts/ajax/drive-touto-dobou.php @@ -65,12 +65,12 @@ for($a = 0; $a < count($dny2); $a++) { - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme WHERE kdy >= CAST('".substr($dny2[$a], 0, 14)."0' AS datetime) AND kdy <= CAST('".substr($dny2[$a], 0, 14)."9' AS datetime) LIMIT 1"); - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); echo " ".formatDnu($dny2[$a])." diff --git a/app/scripts/ajax/pocet-mereni.php b/app/scripts/ajax/pocet-mereni.php index 8ad6d93..326f139 100644 --- a/app/scripts/ajax/pocet-mereni.php +++ b/app/scripts/ajax/pocet-mereni.php @@ -14,8 +14,8 @@ require "../fce.php"; // skript s nekolika funkcemi // Pocet mereni - $dotaz = MySQL_query("SELECT count(id) AS pocet FROM tme"); - $pocetMereni = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT count(id) AS pocet FROM tme"); + $pocetMereni = MySQLi_fetch_assoc($dotaz); header('Content-type: text/html; charset=UTF-8'); diff --git a/app/scripts/ajax/teplota.php b/app/scripts/ajax/teplota.php index ccc3ad9..e1e0482 100644 --- a/app/scripts/ajax/teplota.php +++ b/app/scripts/ajax/teplota.php @@ -49,11 +49,11 @@ // Vycteni hodnot // Posledni mereni - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); - $posledni = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); + $posledni = MySQLi_fetch_assoc($dotaz); // Starsi mereni - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 5, 1"); - $starsi = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 5, 1"); + $starsi = MySQLi_fetch_assoc($dotaz); // vyvoj teploty if($posledni['teplota'] > $starsi['teplota']) diff --git a/app/scripts/db.php b/app/scripts/db.php index 3c6f768..1370075 100644 --- a/app/scripts/db.php +++ b/app/scripts/db.php @@ -6,10 +6,10 @@ *** Pripojeni k DB / DB connection *** *************************************************************************/ -if (!MySQL_connect($dbServer,$dbUzivatel,$dbHeslo)) - echo "Nepodarilo se spojit s databazi. Prosim, zkontrolujte nastaveni.
    - Unable to connect into database. Please, check out your settings."; +if(!($GLOBALS["DBC"] = MySQLi_connect($dbServer, $dbUzivatel, $dbHeslo))) + echo "Nepodarilo se spojit s databazovym serverem a prihlasit se. Prosim, zkontrolujte nastaveni.
    + Unable to connect to database server and log in. Please, check out your settings."; -if (!MySQL_select_db($dbDb)) - echo "Chyba ve vybrani databaze. Prosim, zkontrolujte nastaveni.
    - Unable to select database. Please, check out your settings."; +if(!((bool)mysqli_query($GLOBALS["DBC"], "USE {$dbDb}"))) + echo "Chyba ve vybrani databaze \"{$dbDb}\". Prosim, zkontrolujte nastaveni.
    + Unable to select database \"{$dbDb}\". Please, check out your settings."; diff --git a/app/scripts/dopocitat.php b/app/scripts/dopocitat.php index 46e65b5..505aa0e 100644 --- a/app/scripts/dopocitat.php +++ b/app/scripts/dopocitat.php @@ -26,27 +26,27 @@ $vcera = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); // Nejdriv najdeme posledni dopocitany den krome dnesniho - $q = MySQL_query("SELECT MAX(den) AS den FROM tme_denni"); - $h = MySQL_fetch_assoc($q); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT MAX(den) AS den FROM tme_denni"); + $h = MySQLi_fetch_assoc($q); // je potreba neco dopocitavat? - if(MySQL_num_rows($q) == 0 OR $h['den'] != $vcera) + if(MySQLi_num_rows($q) == 0 OR $h['den'] != $vcera) { // takova hloupost...cheme dalsi den :) if($h['den'] != ""){ $h['den2'] = $h['den']." 23:59:59"; } - $q = MySQL_query("SELECT kdy + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy FROM tme WHERE kdy > '{$h['den2']}' AND kdy < '".date("Y-m-d")."' GROUP BY year(kdy),month(kdy),day(kdy) ORDER BY kdy ASC"); // Mame co dopocitavat? - if(MySQL_num_rows($q) > 0) + if(MySQLi_num_rows($q) > 0) { - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // vytahneme den z datetime @@ -56,21 +56,21 @@ // nejdrive naplnime tabulku cache, kde budou radky jen pro dopocitavany den // a tu potrapime radou dotazu misto toho, abysme ty dotazy vykonavali nad // tabulkou se vsemi merenimi, ktera mohou jit do milionu zaznamu - MySQL_query("INSERT INTO tme_cache(id, kdy, teplota, vlhkost) - SELECT id, kdy, teplota, vlhkost - FROM tme - WHERE kdy >= CAST('{$den} 00:00:00' AS datetime) - AND kdy <= CAST('{$den} 23:59:59' AS datetime)"); + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme_cache(id, kdy, teplota, vlhkost) + SELECT id, kdy, teplota, vlhkost + FROM tme + WHERE kdy >= CAST('{$den} 00:00:00' AS datetime) + AND kdy <= CAST('{$den} 23:59:59' AS datetime)"); // mereni za den - $qV = MySQL_query("SELECT COUNT(id) AS pocet, - MIN(teplota) AS minteplota, MAX(teplota) AS maxteplota, AVG(teplota) AS avgteplota, - MIN(vlhkost) AS minvlh, MAX(vlhkost) AS maxvlh, AVG(vlhkost) AS avgvlh - FROM tme_cache - WHERE kdy >= CAST('{$den} 00:00:00' AS datetime) - AND kdy <= CAST('{$den} 23:59:59' AS datetime)"); + $qV = MySQLi_query($GLOBALS["DBC"], "SELECT COUNT(id) AS pocet, + MIN(teplota) AS minteplota, MAX(teplota) AS maxteplota, AVG(teplota) AS avgteplota, + MIN(vlhkost) AS minvlh, MAX(vlhkost) AS maxvlh, AVG(vlhkost) AS avgvlh + FROM tme_cache + WHERE kdy >= CAST('{$den} 00:00:00' AS datetime) + AND kdy <= CAST('{$den} 23:59:59' AS datetime)"); - $qVhod = MySQL_fetch_assoc($qV); + $qVhod = MySQLi_fetch_assoc($qV); $hod['mereni'] = $qVhod['pocet']; $hod['nejnizsi'] = $qVhod['minteplota']; @@ -96,14 +96,14 @@ (strlen($a) == 1 ? $c = "0".$a : $c = $a); // mereni za danou hodinu - $qV = MySQL_query("SELECT COUNT(id) AS pocet, - MIN(teplota) AS minteplota, MAX(teplota) AS maxteplota, AVG(teplota) AS avgteplota, - MIN(vlhkost) AS minvlh, MAX(vlhkost) AS maxvlh, AVG(vlhkost) AS avgvlh - FROM tme_cache - WHERE kdy >= CAST('{$den} {$c}:00:00' AS datetime) - AND kdy <= CAST('{$den} {$c}:59:59' AS datetime)"); - - $qVhod = MySQL_fetch_assoc($qV); + $qV = MySQLi_query($GLOBALS["DBC"], "SELECT COUNT(id) AS pocet, + MIN(teplota) AS minteplota, MAX(teplota) AS maxteplota, AVG(teplota) AS avgteplota, + MIN(vlhkost) AS minvlh, MAX(vlhkost) AS maxvlh, AVG(vlhkost) AS avgvlh + FROM tme_cache + WHERE kdy >= CAST('{$den} {$c}:00:00' AS datetime) + AND kdy <= CAST('{$den} {$c}:59:59' AS datetime)"); + + $qVhod = MySQLi_fetch_assoc($qV); // Mame vubec nejaka mereni? if($qVhod['pocet'] == 0) @@ -134,7 +134,7 @@ } - MySQL_query("INSERT INTO tme_denni (den, mereni, nejnizsi, nejvyssi, prumer, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost, + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme_denni (den, mereni, nejnizsi, nejvyssi, prumer, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost, 0mereni, 0nejnizsi, 0nejvyssi, 0prumer, 0nejnizsi_vlhkost, 0nejvyssi_vlhkost, 0prumer_vlhkost, 1mereni, 1nejnizsi, 1nejvyssi, 1prumer, 1nejnizsi_vlhkost, 1nejvyssi_vlhkost, 1prumer_vlhkost, 2mereni, 2nejnizsi, 2nejvyssi, 2prumer, 2nejnizsi_vlhkost, 2nejvyssi_vlhkost, 2prumer_vlhkost, @@ -185,13 +185,13 @@ {$hod['22mereni']}, {$hod['22nejnizsi']}, {$hod['22nejvyssi']}, {$hod['22prumer']}, {$hod['22nejnizsivlh']}, {$hod['22nejvyssivlh']}, {$hod['22prumervlh']}, {$hod['23mereni']}, {$hod['23nejnizsi']}, {$hod['23nejvyssi']}, {$hod['23prumer']}, {$hod['23nejnizsivlh']}, {$hod['23nejvyssivlh']}, {$hod['23prumervlh']})"); - echo mysql_error(); + echo mysqli_error($GLOBALS["DBC"]); // smazeme docasne zaznamy - mysql_query("TRUNCATE tme_cache;"); + MySQLi_query($GLOBALS["DBC"], "TRUNCATE tme_cache;"); // mame stale pripojeni na MySQL server? - if (!mysql_ping()) { + if (!mysqli_ping($GLOBALS["DBC"])) { echo "

    Skript skončil předčasně. Spusťte jej znovu pro dopočítání dalších dní."; echo "Script ended early. Run it again to calculate more data for past days.

    "; exit; diff --git a/app/scripts/fce.php b/app/scripts/fce.php index 67a9077..b15c0de 100644 --- a/app/scripts/fce.php +++ b/app/scripts/fce.php @@ -135,9 +135,9 @@ function romer($teplota) function kolik($co, $kde, $podminky="") { - $k = MySQL_query("SELECT COUNT($co) AS pocet + $k = MySQLi_query($GLOBALS["DBC"], "SELECT COUNT($co) AS pocet FROM $kde $podminky"); - $k = MySQL_fetch_assoc($k); + $k = MySQLi_fetch_assoc($k); return $k['pocet']; @@ -154,10 +154,10 @@ function kolik($co, $kde, $podminky="") function kolikRadek($co, $kde, $podminky="") { - $k = MySQL_query("SELECT $co AS pocet + $k = MySQLi_query($GLOBALS["DBC"], "SELECT $co AS pocet FROM $kde $podminky"); - return MySQL_num_rows($k); + return MySQLi_num_rows($k); } // konec funkce diff --git a/app/scripts/grafy/kombinovane/24-hodin.php b/app/scripts/grafy/kombinovane/24-hodin.php index 5780182..3ce5513 100644 --- a/app/scripts/grafy/kombinovane/24-hodin.php +++ b/app/scripts/grafy/kombinovane/24-hodin.php @@ -9,12 +9,12 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1440"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1440"); // budeme brat kazdy 10ty zaznam, abychom se do grafu rozumne vesli $a = 10; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme za tu dobu, aktualne 40 minut, pocitat prumernou teplotu, diff --git a/app/scripts/grafy/kombinovane/3-dny.php b/app/scripts/grafy/kombinovane/3-dny.php index 216058e..cbb2f04 100644 --- a/app/scripts/grafy/kombinovane/3-dny.php +++ b/app/scripts/grafy/kombinovane/3-dny.php @@ -16,12 +16,12 @@ $do = date("Y-m-d H:m:s"); // Posledni zaznamy vcera - $q = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); // budeme brat kazdy 5ty zaznam $a = 8; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme za tu dobu, aktualne 10 minut, pocitat prumernou teplotu, diff --git a/app/scripts/grafy/kombinovane/4-hodiny.php b/app/scripts/grafy/kombinovane/4-hodiny.php index 8c4630a..beb6762 100644 --- a/app/scripts/grafy/kombinovane/4-hodiny.php +++ b/app/scripts/grafy/kombinovane/4-hodiny.php @@ -9,12 +9,12 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 240"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 240"); // budeme pocitat kazdy osmy zaznam, tedy kazdou osmou minutu $a = 6; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme pocitat prumernou teplotu za poslednich osm minut... vypada to lepe diff --git a/app/scripts/grafy/teplota/24-hodin-mobile.php b/app/scripts/grafy/teplota/24-hodin-mobile.php index 202facc..184c445 100644 --- a/app/scripts/grafy/teplota/24-hodin-mobile.php +++ b/app/scripts/grafy/teplota/24-hodin-mobile.php @@ -9,13 +9,13 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 1440"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 1440"); // budeme brat kazdy 40ty zaznam, abychom se do grafu rozumne vesli $a = 10; $count = 0; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme za tu dobu, aktualne 40 minut, pocitat prumernou teplotu, diff --git a/app/scripts/grafy/teplota/24-hodin.php b/app/scripts/grafy/teplota/24-hodin.php index 28c2b21..1e5d85f 100644 --- a/app/scripts/grafy/teplota/24-hodin.php +++ b/app/scripts/grafy/teplota/24-hodin.php @@ -9,13 +9,13 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 1440"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 1440"); // budeme brat kazdy 40ty zaznam, abychom se do grafu rozumne vesli $a = 10; $count = 0; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme za tu dobu, aktualne 40 minut, pocitat prumernou teplotu, diff --git a/app/scripts/grafy/teplota/3-dny.php b/app/scripts/grafy/teplota/3-dny.php index bd71622..c7583ea 100644 --- a/app/scripts/grafy/teplota/3-dny.php +++ b/app/scripts/grafy/teplota/3-dny.php @@ -18,10 +18,10 @@ $tep = 0; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); $a = 5; $fr = 1; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { $tep = $tep+$t['teplota']; if($a == 5) diff --git a/app/scripts/grafy/teplota/31-dni.php b/app/scripts/grafy/teplota/31-dni.php index b1ac0ac..a586313 100644 --- a/app/scripts/grafy/teplota/31-dni.php +++ b/app/scripts/grafy/teplota/31-dni.php @@ -9,8 +9,8 @@ require "./scripts/init.php"; // maximalni teplota dany den - $qj = MySQL_query("SELECT den, nejvyssi, nejnizsi, prumer FROM tme_denni ORDER BY den DESC LIMIT 0, 31"); - while($hod = MySQL_fetch_assoc($qj)) + $qj = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejvyssi, nejnizsi, prumer FROM tme_denni ORDER BY den DESC LIMIT 0, 31"); + while($hod = MySQLi_fetch_assoc($qj)) { // popisek $labels[] = formatDnu($hod['den']); diff --git a/app/scripts/grafy/teplota/4-hodiny.php b/app/scripts/grafy/teplota/4-hodiny.php index 9d4878d..4c1e7f5 100644 --- a/app/scripts/grafy/teplota/4-hodiny.php +++ b/app/scripts/grafy/teplota/4-hodiny.php @@ -9,13 +9,13 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 240"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 240"); // budeme pocitat kazdy osmy zaznam, tedy kazdou osmou minutu $a = 8; $count = 0; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme pocitat prumernou teplotu za poslednich osm minut... vypada to lepe diff --git a/app/scripts/grafy/teplota/historie.php b/app/scripts/grafy/teplota/historie.php index 99990fe..6a9681f 100644 --- a/app/scripts/grafy/teplota/historie.php +++ b/app/scripts/grafy/teplota/historie.php @@ -11,14 +11,14 @@ for($a = 0; $a < 24; $a++) { - $q = MySQL_query("SELECT kdy, teplota + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme WHERE kdy >= CAST('{$_GET['jenden']} ".(strlen($a) == 1 ? "0".$a : $a).":00:00' AS datetime) AND kdy <= CAST('{$_GET['jenden']} ".(strlen($a) == 1 ? "0".$a : $a).":59:59' AS datetime) ORDER BY kdy ASC LIMIT 1"); - $t = MySQL_fetch_assoc($q); + $t = MySQLi_fetch_assoc($q); // pridame teplotu do pole if($t['teplota'] == ""){ $ydata[] = "0"; } diff --git a/app/scripts/grafy/teplota/mesicni.php b/app/scripts/grafy/teplota/mesicni.php index 47c6d00..8b9c668 100644 --- a/app/scripts/grafy/teplota/mesicni.php +++ b/app/scripts/grafy/teplota/mesicni.php @@ -9,14 +9,14 @@ require "./scripts/init.php"; // nacteme mesicni teploty - $dotaz = MySQL_query("SELECT den as mesic, AVG(prumer) as prumer, MIN(nejnizsi) as nejnizsi, MAX(nejvyssi) as nejvyssi + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT den as mesic, AVG(prumer) as prumer, MIN(nejnizsi) as nejnizsi, MAX(nejvyssi) as nejvyssi FROM tme_denni GROUP BY year(den), month(den) ORDER BY den DESC LIMIT 1, 36"); // hodime do pole - while($data = MySQL_fetch_assoc($dotaz)) + while($data = MySQLi_fetch_assoc($dotaz)) { if(round($data['nejvyssi'], 2) == 0){ $ydata[] = "0"; } diff --git a/app/scripts/grafy/teplota/rocni.php b/app/scripts/grafy/teplota/rocni.php index 487218f..3a56f0c 100644 --- a/app/scripts/grafy/teplota/rocni.php +++ b/app/scripts/grafy/teplota/rocni.php @@ -6,13 +6,13 @@ *************************************************************************/ // nacteme mesicni teploty - $dotaz = MySQL_query("SELECT den, prumer, nejnizsi, nejvyssi + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT den, prumer, nejnizsi, nejvyssi FROM tme_denni WHERE den LIKE '".intval($_GET['rok'])."-%' ORDER BY den DESC"); // hodime do pole - while($data = MySQL_fetch_assoc($dotaz)) + while($data = MySQLi_fetch_assoc($dotaz)) { if(round($data['nejvyssi'], 2) == 0){ $ydata[] = "0"; } diff --git a/app/scripts/grafy/vlhkost/24-hodin-mobile.php b/app/scripts/grafy/vlhkost/24-hodin-mobile.php index ab33ea7..406377d 100644 --- a/app/scripts/grafy/vlhkost/24-hodin-mobile.php +++ b/app/scripts/grafy/vlhkost/24-hodin-mobile.php @@ -9,13 +9,13 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1440"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1440"); // budeme brat kazdy 40ty zaznam, abychom se do grafu rozumne vesli $a = 10; $count = 0; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme za tu dobu, aktualne 40 minut, pocitat prumernou teplotu, diff --git a/app/scripts/grafy/vlhkost/3-dny.php b/app/scripts/grafy/vlhkost/3-dny.php index 311335b..cbd2874 100644 --- a/app/scripts/grafy/vlhkost/3-dny.php +++ b/app/scripts/grafy/vlhkost/3-dny.php @@ -18,10 +18,10 @@ $tep = 0; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, vlhkost FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme WHERE kdy > '{$od}' AND kdy < '{$do}' ORDER BY kdy DESC"); $a = 5; $fr = 1; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { $tep = $tep+$t['vlhkost']; if($a == 5) diff --git a/app/scripts/grafy/vlhkost/31-dni.php b/app/scripts/grafy/vlhkost/31-dni.php index 2c45284..b9c53a4 100644 --- a/app/scripts/grafy/vlhkost/31-dni.php +++ b/app/scripts/grafy/vlhkost/31-dni.php @@ -9,8 +9,8 @@ require "./scripts/init.php"; // maximalni teplota dany den - $qj = MySQL_query("SELECT den, nejvyssi_vlhkost, nejnizsi_vlhkost, prumer_vlhkost FROM tme_denni ORDER BY den DESC LIMIT 0, 31"); - while($hod = MySQL_fetch_assoc($qj)) + $qj = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejvyssi_vlhkost, nejnizsi_vlhkost, prumer_vlhkost FROM tme_denni ORDER BY den DESC LIMIT 0, 31"); + while($hod = MySQLi_fetch_assoc($qj)) { // popisek $labels[] = formatDnu($hod['den']); diff --git a/app/scripts/grafy/vlhkost/4-hodiny.php b/app/scripts/grafy/vlhkost/4-hodiny.php index afabab2..99124c5 100644 --- a/app/scripts/grafy/vlhkost/4-hodiny.php +++ b/app/scripts/grafy/vlhkost/4-hodiny.php @@ -9,13 +9,13 @@ require "./scripts/init.php"; // Posledni zaznamy - $q = MySQL_query("SELECT kdy, vlhkost FROM tme ORDER BY kdy DESC LIMIT 240"); + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme ORDER BY kdy DESC LIMIT 240"); // budeme pocitat kazdy osmy zaznam, tedy kazdou osmou minutu $a = 8; $count = 0; - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { // budeme pocitat prumernou teplotu za poslednich osm minut... vypada to lepe diff --git a/app/scripts/grafy/vlhkost/historie.php b/app/scripts/grafy/vlhkost/historie.php index 90de50c..2dc234b 100644 --- a/app/scripts/grafy/vlhkost/historie.php +++ b/app/scripts/grafy/vlhkost/historie.php @@ -11,14 +11,14 @@ for($a = 0; $a < 24; $a++) { - $q = MySQL_query("SELECT kdy, vlhkost + $q = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme WHERE kdy >= CAST('{$_GET['jenden']} ".(strlen($a) == 1 ? "0".$a : $a).":00:00' AS datetime) AND kdy <= CAST('{$_GET['jenden']} ".(strlen($a) == 1 ? "0".$a : $a).":59:59' AS datetime) ORDER BY kdy ASC LIMIT 1"); - $t = MySQL_fetch_assoc($q); + $t = MySQLi_fetch_assoc($q); // pridame teplotu do pole if($t['vlhkost'] == ""){ $ydata[] = "0"; } diff --git a/app/scripts/grafy/vlhkost/mesicni.php b/app/scripts/grafy/vlhkost/mesicni.php index 9b71daa..e61613b 100644 --- a/app/scripts/grafy/vlhkost/mesicni.php +++ b/app/scripts/grafy/vlhkost/mesicni.php @@ -9,7 +9,7 @@ require "./scripts/init.php"; // nacteme mesicni teploty - $dotaz = MySQL_query("SELECT den as mesic, AVG(prumer_vlhkost) as prumer, MIN(nejnizsi_vlhkost) as nejnizsi, MAX(nejvyssi_vlhkost) as nejvyssi + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT den as mesic, AVG(prumer_vlhkost) as prumer, MIN(nejnizsi_vlhkost) as nejnizsi, MAX(nejvyssi_vlhkost) as nejvyssi FROM tme_denni WHERE nejnizsi_vlhkost > 0 GROUP BY year(den), month(den) @@ -17,7 +17,7 @@ LIMIT 1, 36"); // hodime do pole - while($data = MySQL_fetch_assoc($dotaz)) + while($data = MySQLi_fetch_assoc($dotaz)) { if(round($data['nejvyssi'], 2) == 0){ $ydata[] = "0"; } diff --git a/app/scripts/grafy/vlhkost/rocni.php b/app/scripts/grafy/vlhkost/rocni.php index a2dba7e..4e78b99 100644 --- a/app/scripts/grafy/vlhkost/rocni.php +++ b/app/scripts/grafy/vlhkost/rocni.php @@ -8,16 +8,16 @@ if(isset($ydata)){ unset($ydata); unset($ydata2); unset($ydata3); unset($labels); } // nacteme mesicni teploty - $dotaz = MySQL_query("SELECT den, prumer_vlhkost as prumer, nejnizsi_vlhkost as nejnizsi, nejvyssi_vlhkost as nejvyssi + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT den, prumer_vlhkost as prumer, nejnizsi_vlhkost as nejnizsi, nejvyssi_vlhkost as nejvyssi FROM tme_denni WHERE nejnizsi_vlhkost > 0 AND den LIKE '".intval($_GET['rok'])."-%' ORDER BY den DESC"); - if(MySQL_num_rows($dotaz) > 0) + if(MySQLi_num_rows($dotaz) > 0) { // hodime do pole - while($data = MySQL_fetch_assoc($dotaz)) + while($data = MySQLi_fetch_assoc($dotaz)) { if(round($data['nejnizsi']) > 0) diff --git a/app/scripts/head.php b/app/scripts/head.php index 80c0721..5a19ca5 100644 --- a/app/scripts/head.php +++ b/app/scripts/head.php @@ -89,12 +89,12 @@ for($a = 0; $a < count($dny2); $a++) { - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme WHERE kdy >= CAST('".substr($dny2[$a], 0, 14)."0' AS datetime) AND kdy <= CAST('".substr($dny2[$a], 0, 14)."9' AS datetime) LIMIT 1"); - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); echo " ".formatDnu($dny2[$a])." diff --git a/app/scripts/initIndex.php b/app/scripts/initIndex.php index c8b8ff9..13a2a42 100644 --- a/app/scripts/initIndex.php +++ b/app/scripts/initIndex.php @@ -6,24 +6,24 @@ *************************************************************************/ // Pocet mereni - $dotaz = MySQL_query("SELECT count(id) AS pocet, MIN(kdy) AS kdy FROM tme"); - $pocetMereni = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT count(id) AS pocet, MIN(kdy) AS kdy FROM tme"); + $pocetMereni = MySQLi_fetch_assoc($dotaz); // Posledni mereni - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); - $posledni = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); + $posledni = MySQLi_fetch_assoc($dotaz); // Starsi mereni - $dotaz = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 5, 1"); - $starsi = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY kdy DESC LIMIT 5, 1"); + $starsi = MySQLi_fetch_assoc($dotaz); // Nejvyssi namerena teplota - $dotaz = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY teplota DESC LIMIT 1"); - $nejvyssi = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY teplota DESC LIMIT 1"); + $nejvyssi = MySQLi_fetch_assoc($dotaz); // Nejnizsi namerena teplota - $dotaz = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY teplota ASC LIMIT 1"); - $nejnizsi = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY teplota ASC LIMIT 1"); + $nejnizsi = MySQLi_fetch_assoc($dotaz); // vyvoj teploty if($posledni['teplota'] > $starsi['teplota']) diff --git a/app/scripts/modals/driveToutoDobou.php b/app/scripts/modals/driveToutoDobou.php index c8d2304..5319e15 100644 --- a/app/scripts/modals/driveToutoDobou.php +++ b/app/scripts/modals/driveToutoDobou.php @@ -55,13 +55,13 @@ // Pridame do pole pro graf $dnyGraf[] = formatDnu($dny2[$a]); // Zjistime hodnoty pro dane desetiminuti - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme WHERE kdy >= CAST('".substr($dny2[$a], 0, 14)."0' AS datetime) AND kdy <= CAST('".substr($dny2[$a], 0, 14)."9' AS datetime) LIMIT 1"); // Nacteme do promenne - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); // Teplota neprazdna if($hod['teplota'] == "" OR $hod['teplota'] == null) { diff --git a/app/scripts/modals/mesicniStatistiky.php b/app/scripts/modals/mesicniStatistiky.php index f42da78..bb04868 100644 --- a/app/scripts/modals/mesicniStatistiky.php +++ b/app/scripts/modals/mesicniStatistiky.php @@ -12,14 +12,14 @@ $dny = Array(); $minmax = Array(); - $dotaz = MySQL_query("SELECT den as mesic, MIN(nejnizsi) as nejnizsi, MAX(nejvyssi) as nejvyssi + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT den as mesic, MIN(nejnizsi) as nejnizsi, MAX(nejvyssi) as nejvyssi FROM tme_denni GROUP BY year(den), month(den) ORDER BY den DESC LIMIT 1, 60"); // hodime do pole - while($data = MySQL_fetch_assoc($dotaz)) + while($data = MySQLi_fetch_assoc($dotaz)) { if(round($data['nejvyssi'], 2) == 0){ $vysoka = "0"; } @@ -38,13 +38,13 @@ require "../grafy/teplota/mesicniRozptyl.php"; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni GROUP BY year(den),month(den) ORDER BY prumer DESC LIMIT 50"); - if(MySQL_num_rows($qStat) > 2) + if(MySQLi_num_rows($qStat) > 2) { /////////////////////////// @@ -63,7 +63,7 @@ {$lang['prumernateplota']} "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." @@ -88,13 +88,13 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 50"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." @@ -110,7 +110,7 @@ if($vlhkomer == 1) { - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE prumer_vlhkost > 0 GROUP BY year(den),month(den) @@ -127,7 +127,7 @@ {$lang['prumernavlhkost']} "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." @@ -152,14 +152,14 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE prumer_vlhkost > 0 GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 50"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." @@ -188,13 +188,13 @@ /////////////////////////// // nacteme nejvice mereni /////////////////////////// - $qStat = MySQL_query("SELECT den, mereni + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni FROM tme_denni GROUP BY year(den),month(den) ORDER BY mereni DESC LIMIT 50"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." @@ -220,13 +220,13 @@ /////////////////////////// // nacteme nejmene mereni /////////////////////////// - $qStat = MySQL_query("SELECT den, mereni + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni FROM tme_denni GROUP BY year(den),month(den) ORDER BY mereni ASC LIMIT 50"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)." diff --git a/app/scripts/modals/nejTeploty.php b/app/scripts/modals/nejTeploty.php index a1d5835..278f0aa 100644 --- a/app/scripts/modals/nejTeploty.php +++ b/app/scripts/modals/nejTeploty.php @@ -17,23 +17,23 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, nejnizsi as teplota + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejnizsi as teplota FROM tme_denni WHERE nejnizsi IS NOT null ORDER BY nejnizsi ASC LIMIT 15"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // Zjistime presny cas - $dotaz = MySQL_query("SELECT kdy + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy FROM tme WHERE (kdy >= CAST('{$r['den']} 00:00:00' AS datetime) AND kdy <= CAST('{$r['den']} 23:59:59' AS datetime)) AND teplota LIKE {$r['teplota']} LIMIT 1"); // Nacteme do promenne - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); // zelene = vikend $vikend = jeVikend($r['den']); @@ -57,13 +57,13 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, prumer as teplota + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, prumer as teplota FROM tme_denni WHERE prumer IS NOT null ORDER BY prumer ASC LIMIT 15"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // zelene = vikend @@ -91,21 +91,21 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, nejvyssi as teplota + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejvyssi as teplota FROM tme_denni WHERE nejvyssi IS NOT null ORDER BY nejvyssi DESC LIMIT 15"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // Zjistime presny cas - $dotaz = MySQL_query("SELECT kdy + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy FROM tme WHERE (kdy >= CAST('{$r['den']} 00:00:00' AS datetime) AND kdy <= CAST('{$r['den']} 23:59:59' AS datetime)) AND teplota LIKE {$r['teplota']} LIMIT 1"); // Nacteme do promenne - $hod = MySQL_fetch_assoc($dotaz); + $hod = MySQLi_fetch_assoc($dotaz); // zelene = vikend $vikend = jeVikend($r['den']); @@ -128,13 +128,13 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, prumer as teplota + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, prumer as teplota FROM tme_denni WHERE prumer IS NOT null ORDER BY prumer DESC LIMIT 15"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // zelene = vikend diff --git a/app/scripts/modals/pocetMereni.php b/app/scripts/modals/pocetMereni.php index 681b49b..e47f0d5 100644 --- a/app/scripts/modals/pocetMereni.php +++ b/app/scripts/modals/pocetMereni.php @@ -17,13 +17,13 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, mereni + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni FROM tme_denni WHERE mereni IS NOT null ORDER BY mereni ASC LIMIT 50"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // zelene = vikend @@ -51,12 +51,12 @@ $tabulka .= ""; // Nacteme dny a teploty - $q = MySQL_query("SELECT den, mereni + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni FROM tme_denni WHERE mereni IS NOT null ORDER BY mereni DESC LIMIT 50"); - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { // zelene = vikend diff --git a/app/scripts/modals/teplotyZaPosledniDny.php b/app/scripts/modals/teplotyZaPosledniDny.php index fec4178..5ac8926 100644 --- a/app/scripts/modals/teplotyZaPosledniDny.php +++ b/app/scripts/modals/teplotyZaPosledniDny.php @@ -19,7 +19,7 @@ echo "

    {$lang['teplotyzaposlednidny']} ({$jednotka})

    "; // nacteme teploty do tabulky pro poslednich dny - $qStat = MySQL_query("SELECT den, mereni, nejnizsi, nejvyssi, prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, nejnizsi, nejvyssi, prumer FROM tme_denni ORDER BY den DESC LIMIT 250"); @@ -35,7 +35,7 @@ {$lang['mereni']} "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { $vikend = jeVikend($r['den']); diff --git a/app/scripts/modals/vDobu.php b/app/scripts/modals/vDobu.php index f332503..0e115f8 100644 --- a/app/scripts/modals/vDobu.php +++ b/app/scripts/modals/vDobu.php @@ -32,7 +32,7 @@ /////////////////////////// // nejnizsi /////////////////////////// - $q = MySQL_query("SELECT den, {$_GET['doba']}nejnizsi + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$_GET['doba']}nejnizsi FROM tme_denni WHERE {$_GET['doba']}nejnizsi IS NOT NULL ORDER BY {$_GET['doba']}nejnizsi ASC @@ -42,7 +42,7 @@ {$lang['nejnizsiteploty']} "; - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " ".formatDnu($r['den'])." @@ -53,7 +53,7 @@ /////////////////////////// // nejvyssi /////////////////////////// - $q = MySQL_query("SELECT den, {$_GET['doba']}nejvyssi + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$_GET['doba']}nejvyssi FROM tme_denni ORDER BY {$_GET['doba']}nejvyssi DESC LIMIT 25"); @@ -65,7 +65,7 @@ {$lang['nejvyssiteploty']} "; - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " ".formatDnu($r['den'])." @@ -86,7 +86,7 @@ /////////////////////////// // nejnizsi /////////////////////////// - $q = MySQL_query("SELECT den, {$_GET['doba']}nejnizsi_vlhkost + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$_GET['doba']}nejnizsi_vlhkost FROM tme_denni WHERE {$_GET['doba']}nejnizsi_vlhkost > 0 ORDER BY {$_GET['doba']}nejnizsi_vlhkost ASC @@ -95,7 +95,7 @@ {$lang['nejnizsivlhkost']} "; - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " ".formatDnu($r['den'])." @@ -106,7 +106,7 @@ /////////////////////////// // nejvyssi /////////////////////////// - $q = MySQL_query("SELECT den, {$_GET['doba']}nejvyssi_vlhkost + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$_GET['doba']}nejvyssi_vlhkost FROM tme_denni ORDER BY {$_GET['doba']}nejvyssi_vlhkost DESC LIMIT 25"); @@ -118,7 +118,7 @@ {$lang['nejvyssivlhkost']} "; - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " ".formatDnu($r['den'])." diff --git a/app/scripts/modals/vlhkostZaPosledniDny.php b/app/scripts/modals/vlhkostZaPosledniDny.php index 8d88226..9ce1302 100644 --- a/app/scripts/modals/vlhkostZaPosledniDny.php +++ b/app/scripts/modals/vlhkostZaPosledniDny.php @@ -16,7 +16,7 @@ echo "

    {$lang['vlhkostzaposlednidny']} (%)

    "; // nacteme teploty do tabulky pro poslednich dny - $qStat = MySQL_query("SELECT den, mereni, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost FROM tme_denni WHERE nejnizsi_vlhkost > 0 ORDER BY den DESC @@ -33,7 +33,7 @@ {$lang['mereni']} "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { $vikend = jeVikend($r['den']); diff --git a/app/scripts/tabs/aktualne.php b/app/scripts/tabs/aktualne.php index e003091..c86b197 100644 --- a/app/scripts/tabs/aktualne.php +++ b/app/scripts/tabs/aktualne.php @@ -2,23 +2,23 @@ // Data pro mereni z dneska // Dnes nejnizsi namerena teplota/vlhkost - $dotaz = MySQL_query("SELECT MIN(teplota) as teplota, MIN(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT MIN(teplota) as teplota, MIN(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $nejnizsiDnes = MySQL_fetch_assoc($dotaz); + $nejnizsiDnes = MySQLi_fetch_assoc($dotaz); // Dnes prumerna teplota/vlhkost - $dotaz = MySQL_query("SELECT AVG(teplota) as teplota, AVG(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT AVG(teplota) as teplota, AVG(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $prumernaDnes = MySQL_fetch_assoc($dotaz); + $prumernaDnes = MySQLi_fetch_assoc($dotaz); // Dnes nejvyssi namerena teplota/vlhkost - $dotaz = MySQL_query("SELECT MAX(teplota) as teplota, MAX(vlhkost) as vlhkost + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT MAX(teplota) as teplota, MAX(vlhkost) as vlhkost FROM tme WHERE kdy >= CAST('".date("Y-m-d")." 00:00:00' AS datetime) AND kdy <= CAST('".date("Y-m-d")." 23:59:59' AS datetime)"); - $nejvyssiDnes = MySQL_fetch_assoc($dotaz); + $nejvyssiDnes = MySQLi_fetch_assoc($dotaz); // MIN/AVG/MAX za dnesni den echo "
    diff --git a/app/scripts/tabs/denni-statistiky.php b/app/scripts/tabs/denni-statistiky.php index b17a09f..ec04ffb 100644 --- a/app/scripts/tabs/denni-statistiky.php +++ b/app/scripts/tabs/denni-statistiky.php @@ -6,13 +6,13 @@ *************************************************************************/ // nacteme teploty do tabulky pro poslednich dny - $qStat = MySQL_query("SELECT den, mereni, nejnizsi, nejvyssi, prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, nejnizsi, nejvyssi, prumer FROM tme_denni ORDER BY den DESC LIMIT 50"); // mame dost zaznamu k zobrazeni? - if(MySQL_num_rows($qStat) > 5) + if(MySQLi_num_rows($qStat) > 5) { echo "
    "; require './scripts/grafy/teplota/31-dni.php'; echo "
    "; @@ -41,7 +41,7 @@ /////////////////////////// // nejnizsi /////////////////////////// - $q = MySQL_query("SELECT den, {$a}nejnizsi + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$a}nejnizsi FROM tme_denni WHERE {$a}nejnizsi IS NOT NULL ORDER BY {$a}nejnizsi ASC @@ -51,7 +51,7 @@ "; */ - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " @@ -63,7 +63,7 @@ /////////////////////////// // nejvyssi /////////////////////////// - $q = MySQL_query("SELECT den, {$a}nejvyssi + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$a}nejvyssi FROM tme_denni ORDER BY {$a}nejvyssi DESC LIMIT 1"); @@ -72,7 +72,7 @@ "; */ - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " @@ -115,7 +115,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { $vikend = jeVikend($r['den']); @@ -142,7 +142,7 @@ { // nacteme teploty do tabulky pro poslednich dny - $qStat = MySQL_query("SELECT den, mereni, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, nejnizsi_vlhkost, nejvyssi_vlhkost, prumer_vlhkost FROM tme_denni WHERE nejnizsi_vlhkost > 0 ORDER BY den DESC @@ -177,7 +177,7 @@ /////////////////////////// // nejnizsi /////////////////////////// - $q = MySQL_query("SELECT den, {$a}nejnizsi_vlhkost + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$a}nejnizsi_vlhkost FROM tme_denni WHERE {$a}nejnizsi_vlhkost > 0 ORDER BY {$a}nejnizsi_vlhkost ASC @@ -187,7 +187,7 @@ "; */ - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " @@ -199,7 +199,7 @@ /////////////////////////// // nejvyssi /////////////////////////// - $q = MySQL_query("SELECT den, {$a}nejvyssi_vlhkost + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, {$a}nejvyssi_vlhkost FROM tme_denni ORDER BY {$a}nejvyssi_vlhkost DESC LIMIT 1"); @@ -208,7 +208,7 @@ "; */ - while($r = MySQL_fetch_assoc($q)) + while($r = MySQLi_fetch_assoc($q)) { echo " @@ -247,7 +247,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { $vikend = jeVikend($r['den']); diff --git a/app/scripts/tabs/historie.php b/app/scripts/tabs/historie.php index b976de0..39f8013 100644 --- a/app/scripts/tabs/historie.php +++ b/app/scripts/tabs/historie.php @@ -27,7 +27,7 @@ if(isset($_GET['odeslani']) && $_GET['typ'] == 0) { - $q = MySQL_query("SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), MIN(nejnizsi_vlhkost), MAX(nejvyssi_vlhkost), AVG(prumer_vlhkost), MIN(0nejnizsi), MAX(0nejvyssi), AVG(0prumer), MIN(1nejnizsi), MAX(1nejvyssi), AVG(1prumer), @@ -81,14 +81,14 @@ WHERE den = '{$_GET['jenden']}' GROUP BY den;"); - if(MySQL_num_rows($q) == 0) + if(MySQLi_num_rows($q) == 0) { echo "

    {$lang['nenalezenyzaznam']}

    "; } else { - $r = MySQL_fetch_assoc($q); + $r = MySQLi_fetch_assoc($q); echo "
    {$lang['nejnizsiteploty']}
    {$lang['min2']}{$lang['nejvyssiteploty']}
    {$lang['max2']}{$lang['mereni']}
    {$lang['nejnizsivlhkost']}
    {$lang['min2']}{$lang['nejvyssivlhkost']}
    {$lang['max2']}{$lang['max2']}
    @@ -104,13 +104,13 @@ "; - $qL = MySQL_query("SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), + $qL = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), MIN(nejnizsi_vlhkost), MAX(nejvyssi_vlhkost), AVG(prumer_vlhkost) FROM tme_denni WHERE den LIKE '%-".substr($_GET['jenden'], 5, 6)."' GROUP BY den;"); - while($t = MySQL_fetch_assoc($qL)) + while($t = MySQLi_fetch_assoc($qL)) { echo " diff --git a/app/scripts/tabs/mesicni-statistiky.php b/app/scripts/tabs/mesicni-statistiky.php index 6a9300d..0a55b77 100644 --- a/app/scripts/tabs/mesicni-statistiky.php +++ b/app/scripts/tabs/mesicni-statistiky.php @@ -6,13 +6,13 @@ *************************************************************************/ // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni GROUP BY year(den),month(den) ORDER BY prumer DESC LIMIT 10"); - if(MySQL_num_rows($qStat) > 2) + if(MySQLi_num_rows($qStat) > 2) { /////////////////////////// @@ -38,7 +38,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -63,13 +63,13 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 10"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -85,7 +85,7 @@ if($vlhkomer == 1) { - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE prumer_vlhkost > 0 GROUP BY year(den),month(den) @@ -103,7 +103,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -128,14 +128,14 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE prumer_vlhkost > 0 GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 10"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -164,13 +164,13 @@ /////////////////////////// // nacteme nejvice mereni /////////////////////////// - $qStat = MySQL_query("SELECT den, AVG(mereni) as mereni + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(mereni) as mereni FROM tme_denni GROUP BY year(den),month(den) ORDER BY mereni DESC LIMIT 11"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -196,13 +196,13 @@ /////////////////////////// // nacteme nejmene mereni /////////////////////////// - $qStat = MySQL_query("SELECT den, AVG(mereni) as mereni + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(mereni) as mereni FROM tme_denni GROUP BY year(den),month(den) ORDER BY mereni ASC LIMIT 11"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -223,7 +223,7 @@ // Statistiky 0-24h pro az 12 mesicu dozadu // do pole si nacteme poslednich 12 mesicu ////////////////////////////////////////////////////// - $qStat = MySQL_query("SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, mereni, MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), MIN(nejnizsi_vlhkost), MAX(nejvyssi_vlhkost), AVG(prumer_vlhkost), MIN(0nejnizsi), MAX(0nejvyssi), AVG(0prumer), MIN(1nejnizsi), MAX(1nejvyssi), AVG(1prumer), @@ -278,10 +278,10 @@ ORDER BY den DESC LIMIT 3"); - if(MySQL_num_rows($q) > 0) + if(MySQLi_num_rows($q) > 0) { - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo "
    {$lang['namerenehodnotyvprubehulet']}
    {$lang['prumernateplota']}
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."{$lang['prumernavlhkost']}
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."
    ".substr($r['den'], 0, 4)."/".substr($r['den'], 5, 2)."
    diff --git a/app/scripts/tabs/rocni-statistiky.php b/app/scripts/tabs/rocni-statistiky.php index 2173b4c..d1b5e51 100644 --- a/app/scripts/tabs/rocni-statistiky.php +++ b/app/scripts/tabs/rocni-statistiky.php @@ -5,25 +5,25 @@ *** (c) Michal Ševčík 2007-2013 - multi@tricker.cz *** *************************************************************************/ - $q = MySQL_query("SELECT den + $q = MySQLi_query($GLOBALS["DBC"], "SELECT den FROM tme_denni GROUP BY year(den) ORDER BY den DESC"); - if(MySQL_num_rows($q) > 1) + if(MySQLi_num_rows($q) > 1) { - while($t = MySQL_fetch_assoc($q)) + while($t = MySQLi_fetch_assoc($q)) { $rok = substr($t['den'], 0, 4); - $qStat = MySQL_query("SELECT MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT MIN(nejnizsi), MAX(nejvyssi), AVG(prumer), MIN(nejnizsi_vlhkost), MAX(nejvyssi_vlhkost), AVG(prumer_vlhkost) FROM tme_denni WHERE den LIKE '{$rok}-%' LIMIT 1"); - $r = MySQL_fetch_assoc($qStat); + $r = MySQLi_fetch_assoc($qStat); echo "
    @@ -60,13 +60,13 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, nejvyssi + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejvyssi FROM tme_denni WHERE den LIKE '{$rok}-%' ORDER BY nejvyssi DESC LIMIT 6"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -90,13 +90,13 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, nejnizsi + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejnizsi FROM tme_denni WHERE den LIKE '{$rok}-%' ORDER BY nejnizsi ASC LIMIT 6"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -120,14 +120,14 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni WHERE den LIKE '{$rok}-%' GROUP BY year(den),month(den) ORDER BY prumer DESC LIMIT 6"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -151,14 +151,14 @@ "; // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer) as prumer FROM tme_denni WHERE den LIKE '{$rok}-%' GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 6"); - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -186,13 +186,13 @@ //////////////////////////////// // nacteme - $qStat = MySQL_query("SELECT den, nejvyssi_vlhkost + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejvyssi_vlhkost FROM tme_denni WHERE den LIKE '{$rok}-%' AND nejvyssi_vlhkost > 0 ORDER BY nejvyssi_vlhkost DESC LIMIT 6"); - if(MySQL_num_rows($qStat) > 0) + if(MySQLi_num_rows($qStat) > 0) { echo"
    ".formatDnu($r['den'])."
    ".formatDnu($r['den'])."
    ".$lang['mesic'.substr($r['den'], 5, 2)]."
    ".$lang['mesic'.substr($r['den'], 5, 2)]." @@ -204,7 +204,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -221,13 +221,13 @@ //////////////////////////////// // nacteme - $qStat = MySQL_query("SELECT den, nejnizsi_vlhkost + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, nejnizsi_vlhkost FROM tme_denni WHERE den LIKE '{$rok}-%' AND nejnizsi_vlhkost > 0 ORDER BY nejnizsi_vlhkost ASC LIMIT 6"); - if(MySQL_num_rows($qStat) > 0) + if(MySQLi_num_rows($qStat) > 0) { echo"
    {$lang['vlhkost']}
    ".formatDnu($r['den'])." @@ -240,7 +240,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -257,14 +257,14 @@ //////////////////////////////// // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE den LIKE '{$rok}-%' AND prumer_vlhkost > 0 GROUP BY year(den),month(den) ORDER BY prumer DESC LIMIT 6"); - if(MySQL_num_rows($qStat) > 0) + if(MySQLi_num_rows($qStat) > 0) { @@ -277,7 +277,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " @@ -295,14 +295,14 @@ // nacteme - $qStat = MySQL_query("SELECT den, AVG(prumer_vlhkost) as prumer + $qStat = MySQLi_query($GLOBALS["DBC"], "SELECT den, AVG(prumer_vlhkost) as prumer FROM tme_denni WHERE den LIKE '{$rok}-%' AND prumer_vlhkost > 0 GROUP BY year(den),month(den) ORDER BY prumer ASC LIMIT 6"); - if(MySQL_num_rows($qStat) > 0) + if(MySQLi_num_rows($qStat) > 0) { echo"
    ".formatDnu($r['den'])."{$lang['prumer']}
    ".$lang['mesic'.substr($r['den'], 5, 2)]." @@ -315,7 +315,7 @@ "; - while($r = MySQL_fetch_assoc($qStat)) + while($r = MySQLi_fetch_assoc($qStat)) { echo " diff --git a/app/vstup-MikroTik.php b/app/vstup-MikroTik.php index 09b47eb..d8fd48a 100644 --- a/app/vstup-MikroTik.php +++ b/app/vstup-MikroTik.php @@ -50,14 +50,14 @@ // kontrolujeme IP a sedi if(isset($ip) AND $ip != "" AND $ip == $_SERVER['REMOTE_ADDR']) { - MySQL_query("INSERT INTO tme(kdy, teplota) VALUES(now(), '{$teplota}')"); - print mysql_error(); + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme(kdy, teplota) VALUES(now(), '{$teplota}')"); + print mysqli_error($GLOBALS["DBC"]); } // nekontrolujeme IP elseif($ip == "") { - MySQL_query("INSERT INTO tme(kdy, teplota) VALUES(now(), '{$teplota}')"); - print mysql_error(); + MySQLi_query($GLOBALS["DBC"], "INSERT INTO tme(kdy, teplota) VALUES(now(), '{$teplota}')"); + print mysqli_error($GLOBALS["DBC"]); } // problem? zrejme pozadavek z jine nez z povolene IP else diff --git a/app/vystup-XML.php b/app/vystup-XML.php index c6ca23f..725688c 100644 --- a/app/vystup-XML.php +++ b/app/vystup-XML.php @@ -13,28 +13,28 @@ ////////////////////////////////////////////////////////////////////////// // Posledni mereni -$dotaz = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); -$posledni = MySQL_fetch_assoc($dotaz); +$dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY kdy DESC LIMIT 1"); +$posledni = MySQLi_fetch_assoc($dotaz); // Nejvyssi namerena teplota -$dotaz = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY teplota DESC LIMIT 1"); -$nejvyssi = MySQL_fetch_assoc($dotaz); +$dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY teplota DESC LIMIT 1"); +$nejvyssi = MySQLi_fetch_assoc($dotaz); // Nejnizsi namerena teplota -$dotaz = MySQL_query("SELECT kdy, teplota FROM tme ORDER BY teplota ASC LIMIT 1"); -$nejnizsi = MySQL_fetch_assoc($dotaz); +$dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota FROM tme ORDER BY teplota ASC LIMIT 1"); +$nejnizsi = MySQLi_fetch_assoc($dotaz); // Mame vlkhomer? if($vlhkomer == 1) { // Nejvyssi namerena vlhkost - $dotaz = MySQL_query("SELECT kdy, vlhkost FROM tme ORDER BY vlhkost DESC LIMIT 1"); - $nejvyssiVlhkost = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme ORDER BY vlhkost DESC LIMIT 1"); + $nejvyssiVlhkost = MySQLi_fetch_assoc($dotaz); // Nejnizsi namerena vlhkost - $dotaz = MySQL_query("SELECT kdy, vlhkost FROM tme ORDER BY vlhkost ASC LIMIT 1"); - $nejnizsiVlhkost = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, vlhkost FROM tme ORDER BY vlhkost ASC LIMIT 1"); + $nejnizsiVlhkost = MySQLi_fetch_assoc($dotaz); } diff --git a/app/vystup.php b/app/vystup.php index 4416a78..66bb7b8 100644 --- a/app/vystup.php +++ b/app/vystup.php @@ -18,8 +18,8 @@ ////////////////////////////////////////////////////////////////////////// // Posledni mereni - $dotaz = MySQL_query("SELECT kdy, teplota, vlhkost FROM tme ORDER BY id DESC LIMIT 1"); - $posledni = MySQL_fetch_assoc($dotaz); + $dotaz = MySQLi_query($GLOBALS["DBC"], "SELECT kdy, teplota, vlhkost FROM tme ORDER BY id DESC LIMIT 1"); + $posledni = MySQLi_fetch_assoc($dotaz); $d = explode(" ", formatData($posledni['kdy'])); echo "|".$d[0]."|".$d[1]."|";
    ".$lang['mesic'.substr($r['den'], 5, 2)]."