Example #1
1
            $today = getdate();
            $q = '' . $today[0];
            $orgEdinica = str_replace("'", "''", NNull($_GET['orgEdinica2'], ''));
            $najdiVozila = query("select * from vehicles where organisationid = " . $orgEdinica . " and clientid = " . $cid);
            $brisi = query("delete from alarms where id = " . $id . " and clientid = " . $cid . "");
            while ($row = pg_fetch_array($najdiVozila)) {
                $data[] = $row;
            }
            foreach ($data as $row) {
                $posledno = dlookup("select Max(id)+1 from alarms");
                $ret = query("insert into alarms values('" . $posledno . "','" . $tipNaAlarm . "','" . $orgEdinica . "','" . $dostapno . "','" . $emails . "','" . $sms . "','" . $zvukot . "',1," . Session("client_id") . " , '" . $row["id"] . "',NULL,NULL,NULL,'" . $q . "', 2)");
                //RunSQL("update alarms set alarmtypeid = '" . $tipNaAlarm . "',settings = ".$orgEdinica." , available ='" . $dostapno . "', emails ='" . $emails . "', sms = '" .$sms. "',soundid = '" .$zvukot. "',vehicleid = ".$row["id"].",speed = null,poiid = null,timeofpoi = null,uniqid = ".$q.",typeofgroup = 2  where id = '" . $id . "' and clientid =" .$cid);
            }
        }
        if ($vnesiAlertZa == 3) {
            $today = getdate();
            $q = '' . $today[0];
            $najdiVozila = query("select * from vehicles where clientid = " . $cid);
            $brisi = query("delete from alarms where id = " . $id . " and clientid = " . $cid . "");
            while ($row = pg_fetch_array($najdiVozila)) {
                $data[] = $row;
            }
            foreach ($data as $row) {
                $posledno = dlookup("select Max(id)+1 from alarms");
                $ret = query("insert into alarms values('" . $posledno . "','" . $tipNaAlarm . "','','" . $dostapno . "','" . $emails . "','" . $sms . "','" . $zvukot . "',1," . Session("client_id") . " , '" . $row["id"] . "',NULL ,NULL ,NULL ,'" . $q . "', 3)");
                //RunSQL("update alarms set alarmtypeid = '" . $tipNaAlarm . "',settings = null , available ='" . $dostapno . "', emails ='" . $emails . "', sms = '" .$sms. "',soundid = '" .$zvukot. "',vehicleid = ".$row["id"].",speed = null,poiid = null,timeofpoi = null,uniqid = ".$q.",typeofgroup = 3  where id = '" . $id . "' and clientid =" .$cid);
            }
        }
    }
}
closedb();
Example #2
1
function combat_ticker($alliances, $users)
{
    $week = dlookup("week", "timeinfo");
    foreach ($users as $uid => $count) {
        ticker($uid, "*lbattlereport.php?act=show_own&_minw={$week}&_maxw={$week}*You were involved in " . $count . " battles!", "a");
    }
    foreach ($alliances as $aid => $count) {
        $members = get_alliance_members($aid);
        foreach ($members as $uid => $name) {
            // mop: gabs ausser den eigenen auch noch kämpfe?
            if ($count - $users[$uid] > 0) {
                ticker($uid, "*lbattlereport.php?act=show_alliance&_minw={$week}&_maxw={$week}*Your alliance was involved in " . ($count - $users[$uid]) . " battles!", "a");
            }
        }
    }
}
Example #3
1
				<?php 
        while ($drData = pg_fetch_array($dsData)) {
            $tmpIDA = explode(",", $idUsers);
            $ifNE = true;
            for ($ch = 0; $ch < sizeof($tmpIDA); $ch++) {
                if ($drData["userid"] == $tmpIDA[$ch]) {
                    $ifNE = false;
                    break;
                }
            }
            if ($ifNE) {
                $idUsers .= $drData["userid"] . ",";
            }
            $LastDay = DatetimeFormat(addDay(-1), 'd-m-Y');
            $dt = DateTimeFormat(nnull($LastDay, "01-01-1900"), "Y-m-d" . " 00:00:00");
            $user = dlookup("select fullname from users where id=" . $drData["userid"]);
            $desc = nnull($drData["description"], "/");
            $act = "";
            if (nnull($drData["activity"], "/") != "/") {
                $actarr = explode("/", $drData["activity"]);
                if (count($actarr) > 1) {
                    $actarr = array_reverse($actarr);
                    for ($i = 0; $i < count($actarr); $i++) {
                        $act .= " -> " . dic_($actarr[$i]);
                    }
                } else {
                    $act .= " -> " . dic_($drData["activity"]);
                }
            }
            $act = substr($act, 4);
            ?>
Example #4
0
function createXls()
{
    $page = getQUERY("page");
    $from = getQUERY("from");
    $page1 = $page;
    $req = getQUERY("req");
    $req1 = str_replace("**", "&", $req);
    $url = "";
    $temp = explode("&", $req1);
    $cid = getQUERY("c");
    $uid = getQUERY("u");
    $sd = substr($temp[1], 3);
    $ed = substr($temp[2], 3);
    $lang = substr($temp[0], 2);
    opendb();
    /* format na datum */
    $datetimeformat = dlookup("select datetimeformat from users where id=" . $uid);
    //'Y-m-d h:i:s a'; //
    $datfor = explode(" ", $datetimeformat);
    $dateformat = $datfor[0];
    $timeformat = $datfor[1];
    if ($timeformat == "H:i:s") {
        $e_ = " 23:59";
        $e1_ = "_23:59";
        $s_ = " 00:00";
        $s1_ = "_00:00";
        $tf = " H:i";
    } else {
        $e_ = " 11:59 PM";
        $e1_ = "_11:59_PM";
        $s_ = " 12:00 AM";
        $s1_ = "_12:00_AM";
        $tf = " h:i a";
    }
    $sdG = DateTimeFormat($sd, 'd-m-Y H:i:s');
    $edG = DateTimeFormat($ed, 'd-m-Y H:i:s');
    /* format na datum */
    $nameXls = $page1 . '_' . $cid . '_' . DateTimeFormat($sdG, $dateformat) . $s1_ . '_' . DateTimeFormat($edG, $dateformat) . $e1_ . '.xls';
    $url = $page . "1.php?l=" . $lang . "&u=" . $uid . "&c=" . $cid . "&sd=" . DateTimeFormat($sd, "d-m-Y") . "%2000:00:00&ed=" . DateTimeFormat($ed, "d-m-Y") . "%2023:59:00&from=s";
    closedb();
    if ($from == "s") {
        $handle = fopen('../savePDF/' . $nameXls, 'w+') or die('Cannot open file:  ' . $nameXls);
        $data = file_get_contents("http://panorama.gps.mk/settings/" . $url);
        fwrite($handle, $data);
        fclose($handle);
        echo $nameXls;
    }
}
        if ($lastNalog == '' or $lastNalog != $drActivity["orderno"]) {
            $nalogname1 = dlookup("select name from rnalogheder where id = " . $drActivity["orderno"]);
            $culid1 = dlookup("select culid from rnalogheder where id = " . $drActivity["orderno"]);
            $culid2 = dlookup("select culid from route_defculture where id = " . $culid1);
            $culname = dlookup("select name from route_culture where id = " . $culid2);
            $nalogname = "<font style='font-size:16px'>Налог број: <strong>" . $drActivity["orderno"] . "</strong>";
            if ($nalogname1 != "") {
                $nalogname .= ' (<strong>' . $nalogname1 . '</strong>)</font>';
            }
            //$culture = dlookup("select coalesce((select name from route_culture where id = " . $drActivity["culid"] . "), '/')");
            $nalogname .= "<font style='font-style:italic'><br>Култура: <strong>" . $culname . "</strong>";
            $operation = dlookup("select coalesce((select name from route_operation where id = " . $drActivity["operid"] . "), '/')");
            $nalogname .= "<font style='font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;Операција: <strong>" . $operation . "</strong>";
            $material = dlookup("select coalesce((select name from route_material where id = " . $drActivity["matid"] . "), '/')");
            $nalogname .= "&nbsp;&nbsp;&nbsp;&nbsp;Материјал: <strong>" . $material . "</strong>";
            $mechanisation = dlookup("select coalesce((select name from route_mechanisation where id = " . $drActivity["mechid"] . "), '/')");
            $nalogname .= "&nbsp;&nbsp;&nbsp;&nbsp;Механизација: <strong>" . $mechanisation . "</strong></font>";
            ?>
		
			<tr><td colspan=8 height=25px></td></tr>
			<tr>
		    	<td valign="bottom" height="29px" style="color:#fff; font-size:14px; border:1px solid #ff6633; background-color:#f7962b; padding-bottom: 5px; padding-left: 10px " class="text2" colspan="8"><?php 
            echo $nalogname;
            ?>
</td>
			</tr>
			<tr>
				<td width="5%" height="22px" align="center" style="background-color:#E5E3E3; border:1px dotted #2f5185" class="text2"><strong><?php 
            dic("Reports.Rbr");
            ?>
</strong></td>
Example #6
0
$strSQL .= " and datetime > (select datetime from historylog where vehicleid = " . pg_fetch_result($dsv, 0, "id") . " and datetime <= now() + cast('" . $tzone1 . " hour' as interval) order by datetime desc limit 1)+cast('-' || (select trace from users where id=" . session("user_id") . ") || ' min' as interval)";
$strSQL .= " and datetime <= now() + cast('" . $tzone1 . " hour' as interval) order by datetime asc";
$ds = query($strSQL);
//"select latitude, longitude from historylog where vehicleid = " . pg_fetch_result($dsv, 0, "id") . " order by datetime desc");
$str1 = "";
$str2 = "";
$dist = "";
$dt = "";
$alpha = "";
$lastdt = "";
$lastLon = "";
$lastLat = "";
while ($row = pg_fetch_array($ds)) {
    $dtTmp = new Datetime($row["datetime"]);
    $dtTmp = $dtTmp->format($timeformat . " " . $dateformat);
    $str1 .= "," . $row["longitude"];
    $str2 .= "," . $row["latitude"];
    if ($lastLon != "") {
        $dist .= "," . dlookup("select dist_lonlat(" . $row["latitude"] . ", " . $row["longitude"] . ", " . $lastLat . ", " . $lastLon . ")");
        $alpha .= "," . dlookup("select getalpha(" . $row["latitude"] . ", " . $row["longitude"] . ", " . $lastLat . ", " . $lastLon . ")");
        $dt .= "," . $dtTmp;
        // . " - " . $lastdt;
    }
    $lastLon = $row["longitude"];
    $lastLat = $row["latitude"];
    $lastdt = $dtTmp;
}
$str = $str2 . "#" . $str1 . "#" . $dist . "#" . $dt . "#" . $alpha;
print $str;
//print base64_encode(gzencode($str));
closedb();
Example #7
0
function GetCurrentPosition($RoleID, $ClientID, $UserID)
{
    //if($RoleID == "2")
    $sqlV = "";
    if ($RoleID == "2") {
        $sqlV = "select id from vehicles where clientid=" . $ClientID;
    } else {
        $sqlV = "select vehicleid from uservehicles where userid=" . $UserID . "";
    }
    $ClientTypeID = dlookup("select clienttypeid from clients where id=" . $ClientID);
    $sqlStyles = "";
    $sqlStyles .= "SELECT c1.name engineon, c2.name engineoff, c3.name engineoffpassengeron, c4.name satelliteoff, c5.name taximeteron, c6.name taximeteroffpassengeron, c7.name passiveon, c8.name activeoff ";
    $sqlStyles .= "from users us ";
    $sqlStyles .= "left outer join statuscolors c1 on c1.id=us.engineon ";
    $sqlStyles .= "left outer join statuscolors c2 on c2.id=us.engineoff ";
    $sqlStyles .= "left outer join statuscolors c3 on c3.id=us.engineoffpassengeron ";
    $sqlStyles .= "left outer join statuscolors c4 on c4.id=us.satelliteoff ";
    $sqlStyles .= "left outer join statuscolors c5 on c5.id=us.taximeteron ";
    $sqlStyles .= "left outer join statuscolors c6 on c6.id=us.taximeteroffpassengeron ";
    $sqlStyles .= "left outer join statuscolors c7 on c7.id=us.passiveon ";
    $sqlStyles .= "left outer join statuscolors c8 on c8.id=us.activeoff ";
    $sqlStyles .= "where us.id=" . $UserID;
    $dsStyles = query($sqlStyles);
    //$dsStyles = query("SELECT [c1].[name] [EngineON] from [UserSettings] [us] left outer join [Colors] [c1] on [c1].[id] = [us].[EngineON] where [us].[id]=506");
    //echo "select * from (SELECT c1.name EngineON from UserSettings us left outer join Colors c1 on c1.id=us.EngineON where us.UserId=506) t";
    //echo  odbc_field_name($dsStyles, 1) ;
    //exit;
    $sql = "";
    //$sql .= "select  v.numberofvehicle, v.registration, geonet.dbo.fn_seats_goran(seats) sedista, cp.* ";
    $sql .= "select cast(v.code as integer), v.registration, '1' sedista, cp.* ";
    $sql .= "from currentposition cp ";
    $sql .= "left outer join vehicles v on v.id=cp.vehicleid ";
    $sql .= "where vehicleid in (" . $sqlV . ") order by cast(v.code as integer) asc";
    $ds = query($sql);
    $str = "";
    if ($ClientTypeID == 2) {
        //ako e taksi kompanija
        while ($row = pg_fetch_array($ds)) {
            $lon = $row["longitude"];
            $lat = $row["latitude"];
            //if($row["LongOrientation"] == "W") $lon = "-" . $lon;
            //if($row["LatOrientation"] == "S") $lat = "-" . $lat;
            $stil = "";
            $row["sedista"] = NNull($row["sedista"], 0);
            /*if($row["Ignition"]."" == "0" && $row["sedista"]."" == "0")*/
            $stil = pg_fetch_result($dsStyles, 0, "EngineOFF");
            //if($row["Ignition"]."" == "0" && $row["sedista"]."" <> "0") $stil = pg_fetch_result($dsStyles, 0, "EngineOFFPassengerON");
            //if($row["Ignition"]."" == "1" && $row["sedista"]."" <> "0" &&  $row["Taximeter"]."" == "0") $stil = pg_fetch_result($dsStyles, 0, "TaximeterOFFPassengerON");
            //if($row["Ignition"]."" == "1" && $row["Taximeter"]."" == "1") $stil = pg_fetch_result($dsStyles, 0, "TaximeterON");
            //if($row["Ignition"]."" == "1" && $row["sedista"]."" == "0" and $row["Taximeter"]."" == "0") $stil = pg_fetch_result($dsStyles, 0, "EngineON");
            //if($row["passive"]."" == "1") $stil = pg_fetch_result($dsStyles, 0, "PassiveON");
            if ($row["status"] . "" == "0") {
                $stil = pg_fetch_result($dsStyles, 0, "SatelliteOFF");
            }
            $str .= "#" . $row["code"] . "|" . $lon . "|" . $lat . "|" . "Gray" . "|" . $row["registration"];
        }
    } else {
        // Ostanati
        while ($row = pg_fetch_array($ds)) {
            $lon = $row["longitude"];
            $lat = $row["latitude"];
            //if($row["LongOrientation"] == "W") $lon = "-" . $lon;
            //if($row["LatOrientation"] == "S") $lat = "-" . $lat;
            $stil = "";
            /*if($row["Ignition"]."" == "0") */
            $stil = pg_fetch_result($dsStyles, 0, "EngineON");
            //if($row["Ignition"]."" == "1") $stil = pg_fetch_result($dsStyles, 0, "EngineOFF");
            //if($row["status"] == "1") $stil = pg_fetch_result($dsStyles, 0, "SatelliteOFF");
            $str .= "#" . $row["code"] . "|" . $lon . "|" . $lat . "|" . "Gray" . "|" . $row["registration"];
        }
    }
    return $str;
}
Example #8
0
<?php

include "../include/functions.php";
include "../include/db.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
$id = str_replace("'", "''", NNull($_GET['id'], ''));
opendb();
$kveri = query("select * from companydaysholiday where id = " . $id);
$idTO = pg_fetch_result($kveri, 0, "holidayid");
$proverka = dlookup("SELECT count(*) FROM companydays where typeofholiday = '" . $idTO . "' and clientid =" . Session("client_id"));
if ($proverka > 0) {
    echo 1;
    exit;
} else {
    $brisi = query("Delete from companydaysholiday where id = " . $id . " and clientid =" . Session("client_id"));
}
closedb();
Example #9
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
header("Expires: Mon, 20 Jul 2000 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
set_time_limit(0);
opendb();
$uid = str_replace("'", "''", NNull($_GET['uid'], ''));
//echo "select getGeocode(" . $lat . "," . $lon . ") geocode";
$temp = dlookup("select menuorder from users where id=" . $uid);
echo $temp;
closedb();
Example #10
0
</script>
	 <?php 
$id = str_replace("'", "''", NNull($_GET['id'], ''));
$dspoi = query("select id,name from pointsofinterest where id =" . $id . " and clientid = " . Session("client_id") . "order by name");
if (pg_num_rows($dspoi) == 0) {
    echo dic("Settings.NemaPOI");
} else {
    ?>
	<p><?php 
    echo dic("Settings.SelectPOI");
    ?>
</p>
    <div id="allCheckboxes2">
    <?php 
    while ($row = pg_fetch_array($dspoi)) {
        $count = dlookup("select count(*) from pointsofinterest where id = " . $row["id"] . " and clientid =" . Session("client_id"));
        if ($count == 1) {
            ?>
	            <input type="checkbox" checked="checked" id="<?php 
            echo $row["id"];
            ?>
" /><?php 
            echo $row["name"];
            ?>
 <br />
	            <?php 
        } else {
            ?>
			 <input type="checkbox" id="<?php 
            echo $row["id"];
            ?>
Example #11
0
?>

<?php 
$driverID = nnull(getQUERY("driID"), "");
opendb();
$payStr = "";
$payStr .= "<option value='g'>Готово</option>";
$payStr .= "<option value='f'>Фактура</option>";
if ($driverID != "") {
    $cntCards = dlookup("select count(*) from drivercard where driverid= " . $driverID);
} else {
    $cntCards = 0;
}
if ($cntCards > 0) {
    $dsCards = query("select * from drivercard where driverid= " . $driverID);
    while ($drCards = pg_fetch_array($dsCards)) {
        $nameCard = dlookup("select cardname from clubcards where id=" . $drCards["cardid"]);
        $cardID = $drCards["cardid"];
        //$payStr .= "<option value='k-" . $cardID . "' selected='selected'>" . $nameCard . "</option>";
        $payStr .= "<option value='k-" . $cardID . "' >" . $nameCard . "</option>";
    }
} else {
    $dsCards = query("select * from clubcards where clientid= " . session("client_id") . " order by id asc");
    while ($drCards = pg_fetch_array($dsCards)) {
        $cardID = $drCards["id"];
        $payStr .= "<option value='k-" . $cardID . "'>" . $drCards["cardname"] . "</option>";
    }
}
closedb();
echo $payStr;
exit;
Example #12
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
$dat = getQUERY("dt");
$reg = getQUERY("reg");
$type = getQUERY("type");
$note = getQUERY("note");
//list($d, $m, $y) = explode('-', $dat);
//$a = explode(" ", $y);
//$d1 = explode(":", $a[1]);
//$d2 = explode(".", $d1[2]);
//echo $dat . "<br />";
//echo $d . "_" . $m . "_" . $a[0] . "_" . $d1[0] . "_" . $d1[1] . "_" . $d2[0] . "_" . $d2[1];
//exit;
opendb();
$vehID = dlookup("select id from vehicles where registration='" . $reg . "'");
RunSQL("update alarmshistory set note='" . $note . "' where datetime='" . $dat . "' and vehicleid=" . $vehID . " and name='" . $type . "'");
print "Ok";
closedb();
Example #13
0
}
$toobject = nnull(getQUERY("toobj"), "");
$flag = '0';
$delivery = "";
$deliverycoll = "";
if ($action == 'user') {
    $fromid = session("user_id");
    if ($toobject == 'vehicle') {
        $toid = nnull(getQUERY("toid"), "");
        $toid = dlookup("select id from vehicles where gsmnumber='" . $toid . "'");
    } else {
        $flag = '1';
        $toid = nnull(getQUERY("toid"), "");
        $delivery = ", now()";
        $deliverycoll = ", dtdelivery";
    }
    $garminid = dlookup("select coalesce((select garminid from messages where toid=" . $toid . " order by datetime desc limit 1), 0)");
    $garminid = $garminid + 1;
}
$clientid = session("client_id");
$userid = session("user_id");
$datetime = nnull(getQUERY("dt"), now());
//$datetime = now();
$subject = nnull(getQUERY("subject"), "");
$body = nnull(utf8_urldecode(getQUERY("body")), "");
$checked = '0';
RunSQL("INSERT INTO messages (fromid, toobject, toid, clientid, userid, datetime, subject, body, checked, garminid, flag" . $deliverycoll . ") \r\n\t    VALUES (" . $fromid . ", '" . $toobject . "', " . $toid . ", " . $clientid . ", " . $userid . ", \r\n\t    '" . $datetime . "', '" . $subject . "', '" . $body . "', " . $checked . ", " . $garminid . ", '" . $flag . "'" . $delivery . ")");
closedb();
echo $garminid;
//echo 54336;
exit;
Example #14
0
</strong></td>
	 		</tr>
				<?php 
        while ($drData = pg_fetch_array($dsData)) {
            if ($drData["checked"] == "1") {
                $viewed = "../images/messageread.png";
                $style = "style='position:relative; left:-2px'";
            } else {
                $viewed = "../images/messageunread.png";
                $style = "style='height:14px'";
            }
            $from = dlookup("select fullname from users where id=" . $drData["fromid"]);
            if ($drData["toobject"] == 'user') {
                $to = dlookup("select fullname from users where id=" . $drData["toid"]);
            } else {
                $to = dlookup("select registration from vehicles where id=" . $drData["toid"]);
            }
            ?>
                    
             <tr class="<?php 
            echo $drData["userid"];
            ?>
" height=22px>
             	<!--<td align="center" style="background-color:#fff; border:1px dotted #B8B8B8;" class="text2" ><?php 
            echo $cnt;
            ?>
</td>-->
             	<td align="center" style="background-color:#fff; border:1px dotted #B8B8B8;" class="text2" ><img src=<?php 
            echo $viewed;
            ?>
 <?php 
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
opendb();
?>

<?php 
$id = str_replace("'", "''", NNull($_GET['id'], ''));
$mehanizacija = str_replace("'", "''", NNull($_GET['mehanizacijaIme'], ''));
$mehanizacijaRange = str_replace(",", ".", NNull($_GET['mehanizacijaRange'], ''));
if ($mehanizacijaRange == "") {
    $mehanizacijaRange = 0;
}
$mehanizacijaCheck = dlookup("SELECT count(*) FROM route_mechanisation WHERE clientid = " . Session("client_id") . " and name = '" . $mehanizacija . "' and name not in (select name from route_mechanisation where id=" . $id . ")");
if ($mehanizacijaCheck > 0) {
    echo 1;
} else {
    $updt = query("update route_mechanisation set name = '" . $mehanizacija . "', range =  " . $mehanizacijaRange . " where id = '" . $id . "'  and clientid = " . Session("client_id"));
}
closedb();
Example #16
0
<?php

include "../include/functions.php";
include "../include/db.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
opendb();
$vozacID = str_replace("'", "''", NNull($_GET['id'], ''));
$kartickaID = str_replace("'", "''", NNull($_GET['kartickataID'], ''));
$posledno = dlookup("select Max(id)+1 from drivercard");
$workCheck = dlookup("SELECT count(*) FROM drivercard WHERE driverid = '" . $vozacID . "' and cardid = " . $kartickaID);
if ($workCheck > 0) {
    echo 1;
    exit;
} else {
    $vnesi = query("INSERT into drivercard(id,driverid,cardid) values ('" . $posledno . "','" . $vozacID . "'," . $kartickaID . "); ");
    echo 0;
}
closedb();
Example #17
0
                $speed = '0 mph';
            }
        } else {
            $speed = round(pg_fetch_result($dsCurrPos, 0, "speed"), 0) . ' Km/h';
            if ($metric == "mi") {
                $speed = round(round(pg_fetch_result($dsCurrPos, 0, "speed") * 0.621371 * 100) / 100) . ' mph';
            }
        }
    }
    ?>
	            			<?php 
    echo $speed;
    ?>
	            		</span>
	            		<br>max: <?php 
    $maxspeed = nnull(round(dlookup("select MAX(speed)from rMaxSpeed where  Datetime>='" . DateTimeFormat(now(), "Y-m-d 00:00:00") . "' and  Datetime<='" . DateTimeFormat(now(), "Y-m-d H:i:s") . "' and vehicleID=" . $drVehicle["id"])), "/");
    if ($maxspeed != "/") {
        if ($metric == "mi") {
            $maxspeed = round(round($maxspeed * 0.621371 * 100) / 100) . ' mph';
        } else {
            $maxspeed .= " Km/h";
        }
    }
    ?>
	            	<span id="spanMaxSpeed-<?php 
    echo $drVehicle["id"];
    ?>
" onmousemove="ShowPopup(event, '<span class=\'text5\'><?php 
    echo dic("Reports.MaxSpeedDay");
    ?>
</span>')" onmouseout="HidePopup()"><?php 
Example #18
0
if ($fromto == "inbox") {
    $from = dlookup("select fullname from users where id=" . pg_fetch_result($mess, 0, "fromid"));
    ?>
 		<?php 
    echo dic_("Reports.From");
    ?>
: <strong><?php 
    echo $from;
    ?>
</strong>
 		<?php 
} else {
    if (pg_fetch_result($mess, 0, "toobject") == 'user') {
        $to = dlookup("select fullname from users where id=" . pg_fetch_result($mess, 0, "toid"));
    } else {
        $to = dlookup("select registration from vehicles where id=" . pg_fetch_result($mess, 0, "toid"));
    }
    ?>
 		<?php 
    echo dic_("Reports.To");
    ?>
: <strong><?php 
    echo $to;
    ?>
</strong>
		<?php 
}
?>
 		<br>
 		<?php 
echo dic_("Reports.DateTime");
Example #19
0
     <select id="vozila" style="width: 365px;" class="combobox text2" onchange="OptionsChangeVehicle()">
     	<option value="0"><?php echo dic_("Tracking.SelectOption")?></option>
        <option value="1"><?php echo dic_("Tracking.OneVehicle")?></option>
<?php
	
	
	if (pg_num_rows(query($strOrg)) > 0) {

?>
        <option value="2"><?php echo dic_("Tracking.VehInOrgU")?></option>

	<?php
	}

	
	if ((dlookup("select count(*) from vehicles where clientID=" . session("client_id") . " and active='1'")) == pg_num_rows(query($strCom))) {

	?>
        <option value="3"><?php echo dic_("Tracking.AllVehCompany") ?></option>

	<?php
	}
	?>
     </select>
	 </div>
	 </td>
     </tr>
 
     <tr id="ednoVozilo" style="display:none;">
     <td width = "25%" style="font-weight:bold" class ="text2" align="left"><?php echo dic_("Tracking.SelectVeh")?>:</td>
     <td width = "75%" style="font-weight:bold" class ="text2">
Example #20
0
 *		9 - празник за еврејската заедница
 *		10 - празник за бошњачката заедница
 *		11 - празник за турската заедница
 * 
 */
$imePraznik = str_replace("'", "''", NNull($_GET['imePraznik'], ''));
$datum = DateTimeFormat(getQUERY("Datum"), 'Y-m-d');
opendb();
$tipDen = str_replace("'", "''", NNull($_GET['tipDen'], ''));
//$den = str_replace("'", "''", NNull($_GET['den'], ''));
$den = dlookup("select getdayofweek(cast('" . $datum . "' as date))");
$color = str_replace("'", "''", NNull($_GET['boja'], ''));
$tipPraznik = str_replace("'", "''", NNull($_GET['tipPraznik'], ''));
if ($tipDen == 8) {
    $proverka = query("select * from companydays");
    if (pg_num_rows($proverka) == 0) {
        $vnes = query("insert into companydays(id,clientid,dayname,typeofday,datum,companyholiday,cellcolor\t,typeofholiday) values(1," . Session("client_id") . ",N'" . $imePraznik . "','" . $den . "','" . DateTimeFormat($datum, "Y-m-d") . "','" . $tipDen . "','#" . $color . "','" . $tipPraznik . "'); ");
    } else {
        $posledno = dlookup("select Max(id)+1 from companydays");
        $vnes = query("insert into companydays(id,clientid,dayname,typeofday,datum,companyholiday,cellcolor,typeofholiday) values('" . $posledno . "'," . Session("client_id") . ",N'" . $imePraznik . "','" . $den . "','" . DateTimeFormat($datum, "Y-m-d") . "','" . $tipDen . "','#" . $color . "','" . $tipPraznik . "'); ");
    }
} else {
    $proverka = query("select * from companydays");
    if (pg_num_rows($proverka) == 0) {
        $vnes = query("insert into companydays(id,clientid,dayname,typeofday,datum,companyholiday,cellcolor) values(1," . Session("client_id") . ",N'" . $imePraznik . "','" . $den . "','" . DateTimeFormat($datum, "Y-m-d") . "','" . $tipDen . "','#" . $color . "'); ");
    } else {
        $posledno = dlookup("select Max(id)+1 from companydays");
        $vnes = query("insert into companydays(id,clientid,dayname,typeofday,datum,companyholiday,cellcolor) values('" . $posledno . "'," . Session("client_id") . ",N'" . $imePraznik . "','" . $den . "','" . DateTimeFormat($datum, "Y-m-d") . "','" . $tipDen . "','#" . $color . "'); ");
    }
}
closedb();
Example #21
0
<?php

include "../include/functions.php";
include "../include/db.php";
include "../include/params.php";
include "../include/dictionary2.php";
opendb();
$userid = Session('user_id');
$recordExists = dlookup("select count(1) from userfirstlogin where userid=" . $userid);
if ($recordExists == 0) {
    $userfirstlogin = query("insert into userfirstlogin (userid, firstlogin) values (" . $userid . ", now())");
}
// return the sotored first login date
$recordDate = dlookup("select firstlogin from userfirstlogin where userid=" . $userid);
$days = DateDiffDays($recordDate, now());
echo json_encode($days);
closedb();
exit;
Example #22
0
<?php

include "../include/functions.php";
include "../include/db.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
opendb();
$imeKultura = str_replace("'", "''", NNull($_GET['kulturaIme'], ''));
$posledno = dlookup("select Max(id)+1 from route_culture");
$proverka = dlookup("SELECT count(*) FROM route_culture WHERE name = '" . $imeKultura . "' and clientid = " . Session("client_id"));
if ($proverka > 0) {
    echo 1;
} else {
    $vnesi = query("INSERT into route_culture(id,name,clientid) values ('" . $posledno . "','" . $imeKultura . "'," . Session("client_id") . "); ");
    echo 0;
}
closedb();
Example #23
0
<?php

include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
$id = str_replace("'", "''", NNull($_GET['id'], ''));
opendb();
$daliUniqId = dlookup("select uniqid from alarms where id = " . $id . " and clientid =" . Session("client_id"));
if ($daliUniqId != "") {
    $brisi = query("Delete from alarms where uniqid = " . $daliUniqId . " and clientid =" . Session("client_id"));
} else {
    $brisi = query("Delete from alarms where id = " . $id . " and clientid =" . Session("client_id"));
}
closedb();
Example #24
0
$alarm = getQUERY("alarm");
$zadrz = getQUERY("zadrz");
$pause1 = getQUERY("pause1");
$pause2 = getQUERY("pause2");
$pause3 = getQUERY("pause3");
$pause4 = getQUERY("pause4");
$pause5 = getQUERY("pause5");
/*Za ZKPelagonija*/
$culid = nnull(getQUERY("culid"), 0);
/*Za ZKPelagonija*/
$totalkm = getQUERY("totalkm");
$totaltime = getQUERY("totaltime");
if ($alarm == "/") {
    $alarm = 0;
}
if ($zadrz == "/") {
    $zadrz = 0;
}
//dim dat() as string = split(datum,"-")
//dim datum1 = dat(2) & "-" & dat(1) & "-" & dat(0)
$tmpDT = new DateTime($datum . ' ' . $vreme);
$tmpDT = $tmpDT->format("Y-m-d H:i:s");
$sqlInsert = "insert into rnalogheder (datetime, VehicleID, DriverID1, DriverID2, DriverID3, StartDate, Name, ClientID, userID, Alarm, toStay, Pause1, Pause2, Pause3, Pause4, Pause5, TotalKm, TotalTime, culid) ";
$sqlInsert .= " Values (now(), " . $vozilo . ", " . $sofer1 . ", " . $sofer2 . ", " . $sofer3 . ", '" . $tmpDT . "', '" . $naslov . "', " . session("client_id") . ", " . session("user_id") . ", " . $alarm . ", " . $zadrz . ", " . $pause1 . ", " . $pause2 . ", " . $pause3 . ", " . $pause4 . ", " . $pause5 . ", " . $totalkm . ", " . $totaltime . ", " . $culid . " )";
//$dsInsert = query($sqlInsert);
$dsInsert = dlookup($sqlInsert . " RETURNING id");
//$dsInsert1 = query("select id from rnalogheder order by id desc limit 1");
//$id = pg_fetch_result($dsInsert1, 0, "id");
addlog(38, dic_('Routes.NewOrderWithNumber') . " " . $dsInsert);
print $dsInsert;
closedb();
Example #25
0
$city = nnull(utf8_urldecode(getQUERY('city')), "");
$country = getQUERY("country");
$elevation = nnull(utf8_urldecode(getQUERY('elevation')), "");
$fullname = nnull(utf8_urldecode(getQUERY('fullname')), "");
$lon = getQUERY("lon");
$lat = getQUERY("lat");
$otime = getQUERY("otime");
$temp = getQUERY("temp");
$feelslike = getQUERY("feelslike");
$wind = getQUERY("wind");
$visibility = getQUERY("visibility");
$weather = nnull(utf8_urldecode(getQUERY("weather")), "");
$humidity = getQUERY("humidity");
$icon = nnull(utf8_urldecode(getQUERY("icon")), "");
$iconurl = nnull(utf8_urldecode(getQUERY("iconurl")), "");
$cntW = dlookup("select count(*) from weatherstations where city='" . $city . "'");
if ($cntW > 0) {
    $sqlAddW = "UPDATE weatherstations set observationtime='" . $otime . "', temerature=" . $temp;
    $sqlAddW .= ", feelslike=" . $feelslike . ", weather='" . $weather . "', humidity='" . $humidity;
    $sqlAddW .= "', visibility=" . $visibility . ", wind=" . $wind . ", icon='" . $icon . "', iconurl='" . $iconurl . "'";
    $sqlAddW .= " where city='" . $city . "'";
    RunSQL($sqlAddW);
    echo "update";
} else {
    $sqlAddW = "INSERT INTO weatherstations (city, country, elevation, fullname, latitude, longitude, observationtime, temerature, feelslike, weather, humidity, visibility, wind, icon, iconurl) VALUES ";
    $sqlAddW .= "('" . $city . "', '" . $country . "', '" . $elevation . "', '" . $fullname . "', " . $lat . ", " . $lon . ", '" . $otime . "', " . $temp . ", " . $feelslike . ", '" . $weather . "', '" . $humidity . "', " . $visibility . ", " . $wind . ", '" . $icon . "', '" . $iconurl . "')";
    RunSQL($sqlAddW);
    echo "insert";
}
closedb();
exit;
Example #26
0
<?php 
include "../include/functions.php";
include "../include/db.php";
include "../include/params.php";
include "../include/dictionary2.php";
?>

<?php 
if (session('user_id') == "261") {
    echo header('Location: ../sessionexpired/?l=' . $cLang);
}
if (!is_numeric(session('user_id'))) {
    echo header('Location: ../sessionexpired/?l=' . $cLang);
}
header("Expires: Mon, 20 Jul 2000 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
set_time_limit(0);
$str = "";
opendb();
if (session("role_id") . "" == "2") {
    $str .= dlookup("select getcurrentpositionzone(" . session("user_id") . ", 'select id from vehicles where clientid = " . session("client_id") . "', 'select tourid, vehicleid, vozilo, timein, timeout, diff, poiid, rbr1 from gettoursbycid(" . session("client_id") . ")')");
} else {
    $str .= dlookup("select getcurrentpositionzone(" . session("user_id") . ", 'select vehicleid from uservehicles where userid=" . session("user_id") . "', 'select tourid, vehicleid, vozilo, timein, timeout, diff, poiid, rbr1 from gettoursbyuid(" . session("user_id") . ")')");
}
print $str;
closedb();
Example #27
0
                $sqlAl1 = "";
            }
        } else {
            $dsVehByCID = query("select id from vehicles where clientid=" . session("client_id"));
            while ($row = pg_fetch_array($dsVehByCID)) {
                $sqlAl1 .= "insert into alarms (alarmtypeid, settings, available, emails, sms, soundid, snooze, clientid, vehicleid, poiid, uniqid, typeofgroup) ";
                $sqlAl1 .= " Values ('8', '" . $oeid . "', '" . $_avail . "', '" . $em . "', '" . $ph . "', 1, '" . $snooze . "', '" . session("client_id") . "', '" . $row["id"] . "', '" . $id . "', '" . $q . "', '" . $sidx . "')";
                $dsAl1 = query($sqlAl1);
                $sqlAl1 = "";
            }
        }
    }
}
if ($aliz == "true") {
    $q = $q + 1;
    $snooze = dlookup("select snooze from users where id=" . session("user_id"));
    $sqlAl1 = "";
    if ($sidx == "1") {
        $sqlAl1 .= "insert into alarms (alarmtypeid, settings, available, emails, sms, soundid, snooze, clientid, vehicleid, poiid, typeofgroup) ";
        $sqlAl1 .= " Values ('9', '" . $oeid . "', '" . $_avail . "', '" . $em . "', '" . $ph . "', 1, '" . $snooze . "', '" . session("client_id") . "', '" . $selveh . "', '" . $id . "', '" . $sidx . "')";
        $dsAl1 = query($sqlAl1);
        $sqlAl1 = "";
    } else {
        if ($sidx == "2") {
            $dsVehByOE = query("select id from vehicles where organisationid=" . $oeid);
            while ($row = pg_fetch_array($dsVehByOE)) {
                $sqlAl1 .= "insert into alarms (alarmtypeid, settings, available, emails, sms, soundid, snooze, clientid, vehicleid, poiid, uniqid, typeofgroup) ";
                $sqlAl1 .= " Values ('9', '" . $oeid . "', '" . $_avail . "', '" . $em . "', '" . $ph . "', 1, '" . $snooze . "', '" . session("client_id") . "', '" . $row["id"] . "', '" . $id . "', '" . $q . "', '" . $sidx . "')";
                $dsAl1 = query($sqlAl1);
                $sqlAl1 = "";
            }
Example #28
-1
function getPriv($key, $userID)
{
    $rid = dlookup("select roleid from users where id=" . $userID);
    if ($rid == 2) {
        return 1;
    }
    $ret = nnull(dlookup("select " . $key . " from privilegessettings where userid=" . $userID), 1);
    return $ret;
}
Example #29
-1
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
opendb();
$id = str_replace("'", "''", NNull($_GET['id'], ''));
$ime = str_replace("'", "''", NNull($_GET['name'], ''));
$prezime = str_replace("'", "''", NNull($_GET['lastname'], ''));
$email = str_replace("'", "''", NNull($_GET['email'], ''));
$telefon = str_replace("'", "''", NNull($_GET['phone'], ''));
$username = str_replace("'", "''", NNull($_GET['username'], ''));
$pomosno = str_replace("'", "''", NNull($_GET['pomosno'], ''));
$userCheck = dlookup("SELECT count(*) FROM users WHERE username = '******' and username not in (select username from users where id=" . $id . ")");
if ($userCheck > 0) {
    echo 1;
} elseif ($pomosno == 1) {
    $password = str_replace("'", "''", NNull($_GET['passwordstar'], ''));
    $updt = query("update users set fullname = '" . $ime . " " . $prezime . "', username='******', password='******', email='" . $email . "', phone = '" . $telefon . "'  where id = " . $id . "  and clientid = " . Session("client_id"));
    print $id;
} else {
    $passwordNov = str_replace("'", "''", NNull($_GET['passwordNov'], ''));
    $updt = query("update users set fullname = '" . $ime . " " . $prezime . "', username='******', password='******', email='" . $email . "', phone = '" . $telefon . "'  where id = " . $id . "  and clientid = " . Session("client_id"));
    print $id;
}
closedb();
Example #30
-2
	//ShowHideMail();
	snoozeAlarm();
	AjaxNotify();
	AjaxMessageNotify();
</script>


<?php 
$sqlAlarm = "";
$sqlAlarm .= "select ah.*, v.registration from alarmshistory ah left join vehicles v on v.id=ah.vehicleid ";
$sqlAlarm .= " where ah.vehicleid in (" . $sqlV . ") ";
$sqlAlarm .= " and ah.datetime > cast((select now()) as date) + cast('-1 day' as interval) ";
$sqlAlarm .= " order by read asc, datetime desc";
$dsAlarms = query($sqlAlarm);
$brojac = 1;
$brojac1 = dlookup("select count(*) from alarmshistory where vehicleid in (" . $sqlV . ") and datetime > cast((select now()) as date) + cast('-1 day' as interval) and read='0'");
while ($row = pg_fetch_array($dsAlarms)) {
    $tzDatetime = new DateTime($row["datetime"]);
    list($d, $m, $y) = explode('-', $row["datetime"]);
    $a = explode(" ", $y);
    $d1 = explode(":", $a[1]);
    $d2 = explode(".", $d1[2]);
    $idCreate = $row["vehicleid"] . "_" . $d . "_" . $m . "_" . $a[0] . "_" . $d1[0] . "_" . $d1[1] . "_" . $d2[0] . "_" . $d2[1];
    if ($row["read"] == "0") {
        ?>
			<script>
				AlertEventInit('<?php 
        echo $row["datetime"];
        ?>
', '<?php 
        echo $row["registration"];