Ejemplo n.º 1
0
function loggingIs($type, $tableName, $values, $record)
{
    $normalTable = $tableName;
    $action = '';
    if (strpos($tableName, "_tmp") !== FALSE) {
        $normalTable = substr($tableName, 0, strpos($tableName, "_tmp"));
    }
    if ($type != 3) {
        foreach ($values as $field => $value) {
            $action .= pg_escape_string(' "' . $field . '"=>\'' . $value . '\'');
        }
    }
    $user_res = getCurrUserInfo();
    $user = $user_res['rows'][0]['id'];
    if ($user == "") {
        $user = 1;
    }
    $res = PQuery('SELECT id FROM "LogTableList" WHERE "name"=\'' . $normalTable . '\'');
    if ($res['count']) {
        return 0;
    }
    $tableId = $res['rows'][0]['id'];
    if ($type == 1) {
        $action = 'UPDATED:' . $action;
    } elseif ($type == 2) {
        $action = 'ADDED:' . $action;
        $wr = genWhere($values);
        $query = 'SELECT * FROM "' . pg_escape_string($tableName) . '"' . $wr;
        $res = PQuery($query);
        $record = $res['rows'][0]['id'];
    } elseif ($type == 3) {
        $action = 'DELETED';
    }
    if (!$record || $record == '') {
        $record = 'NULL';
    }
    $query = 'INSERT INTO "LogAdminActions" ("table", "record", "time", "action", "admin") VALUES (' . pg_escape_string($tableId) . ', ' . pg_escape_string($record) . ', NOW(), \'' . $action . '\', ' . pg_escape_string($user) . ')';
    $res = PQuery($query);
    return 1;
}
Ejemplo n.º 2
0
function finishMapSession($userId = -1)
{
    if ($userId == -1) {
        $user_res = getCurrUserInfo();
        $user = $user_res['rows'][0]['id'];
    } else {
        $user = $userId;
    }
    $wr['UserId'] = $user;
    $query = 'UPDATE "MapSessions"
                SET "LastAction" = "LastAction" - INTERVAL \'30 MINUTES\' ' . genWhere($wr);
    PQuery($query);
}
Ejemplo n.º 3
0
<?php

require_once 'auth.php';
require_once 'backend/map.php';
ini_set('display_errors', false);
if (!checkSession() || $_SESSION['class'] > 1) {
    header("Location: map.php");
    exit;
}
$user_res = getCurrUserInfo();
$user = $user_res['rows'][0]['id'];
if (isset($_GET['mode']) && $_GET['mode'] == "logout") {
    finishMapSession();
    header("Location: map.php");
    exit;
}
setMapUserActivity();
//checkData();
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <title>Карта - FiberMS</title>
        <link rel="stylesheet" href="style/ext-all.css" type="text/css">
        <link rel="stylesheet" href="style/buttons.css" type="text/css">
        <link rel="stylesheet" href="style/map_edt.css" type="text/css">
        <style type="text/css">
            #controlToggle li {
                list-style: none;
            }