Пример #1
0
    if (check_systemversion("mysql")) {
        echo '<strong class="ok">Ok.</strong><br />';
    } else {
        $msg = '<strong class="ko">Error:</strong> ';
        $msg .= 'Your server has MySQL ' . mysql_get_client_info() . ' installed, ';
        $msg .= 'but at least version 5 is required to handle this system. ';
        $msg .= $bypass_txt;
        die($msg);
    }
}
/* check PHP version -------------------------------------------------------- */
echo 'Checking PHP version: ';
if ($warn_on) {
    echo '<strong>Bypass.</strong><br />';
} else {
    if (check_systemversion("php")) {
        echo '<strong class="ok">Ok.</strong><br />';
    } else {
        $msg = '<strong class="ko">Error:</strong> ';
        $msg .= 'Your server has PHP ' . phpversion() . ' installed, ';
        $msg .= 'but at least version 5 is required to handle this system. ';
        $msg .= $bypass_txt;
        die($msg);
    }
}
/* check cURL library ------------------------------------------------------- */
echo 'Checking cURL library: ';
if ($warn_on) {
    echo '<strong>Bypass.</strong><br />';
} else {
    if (function_exists("curl_init")) {
Пример #2
0
    $msg .= 'Fortunately, there exist <a rel="external" href="http://www.php.net/manual/en/function.curl-setopt.php#71313">some</a>';
    $msg .= ' <a rel="external" href="http://www.php.net/manual/en/function.curl-setopt.php#79787">workarounds</a>.';
    echo display_text($_displayType["WARNING"], $msg);
}
/* version checking --------------------------------------------------------- */
if (!check_systemversion("mysql", 5)) {
    $dberror = true;
    $msg = '<h2>MySQL version test failed</h2>';
    $msg .= '<p>';
    $msg .= 'You have MySQL <code>' . mysql_get_client_info() . '</code> installed, ';
    $msg .= 'but at least version <strong>5</strong> is required. ';
    $msg .= '<em>You can ignore this message if the system is already working.</em>';
    $msg .= '</p>';
    echo display_text($_displayType["ERROR"], $msg, 'div');
}
if (!check_systemversion("php", 5)) {
    $dberror = true;
    $msg = '<h2>PHP version test failed</h2>';
    $msg .= '<p>';
    $msg .= 'You have PHP <code>' . phpversion() . '</code> installed, ';
    $msg .= 'but at least PHP <strong>5</strong> is required to handle the tracking logs. ';
    $msg .= '<em>You can ignore this warning if the system is already working.</em>';
    $msg .= '</p>';
    echo display_text($_displayType["ERROR"], $msg, 'div');
}
/*
// if no errors are found, display a success message
if (!$dberror) {
  echo '<p class="success">The MySQL server is up and running properly.</p>';
}
*/
Пример #3
0
function format_fields($user, $isAdmin)
{
    global $ROLES, $ROOT;
    $rnd = mt_rand();
    // to match correctly label with id
    $self = $user['login'] === $_SESSION['login'];
    $f = "";
    if (!$isAdmin && $user !== null) {
        $role = db_select(TBL_PREFIX . TBL_ROLES, "*", "id='" . $user['role_id'] . "'");
        if ($role) {
            $f .= 'Your current role is <strong>' . $role['name'] . '</strong>';
            if (!empty($role['description'])) {
                $f .= ' (' . $role['description'] . ').';
            }
        } else {
            $f .= 'You do not have a role assigned.';
        }
    }
    if ($isAdmin) {
        $f .= '<div class="wrapper smallround pl">' . PHP_EOL;
    }
    // check user status
    if ($user !== null) {
        $timediff = time() - strtotime($user['last_access']);
        if ($timediff < 5 * 60) {
            $status = "online";
        } else {
            if ($timediff < 10 * 60) {
                $status = "away";
            } else {
                $status = "offline";
            }
        }
        if ($isAdmin) {
            // show pretty dates instead of timestamps if PHP >= 5.2.0
            if (check_systemversion("php", "5.2.0")) {
                $usePrettyDate = true;
                require_once SYS_DIR . 'prettyDate.php';
            }
            if ($user !== null) {
                $reg = $usePrettyDate ? prettyDate::getStringResolved($user['registered']) : $user['registered'];
                $upd = $usePrettyDate ? prettyDate::getStringResolved($user['last_access']) : $user['last_access'];
                $accesses = ' <small class="mini">Registered ' . $reg . '. Last access: <em>' . $upd . '</em>.</small>';
            }
        }
        $f .= '<h2>';
        $f .= '<img src="' . ADMIN_PATH . 'css/user-' . $status . '.png" alt="[' . $status . ']" title="User ' . $status . '" /> ';
        $f .= $user['login'] . $accesses;
        $f .= '</h2>' . PHP_EOL;
    }
    // create form ---------------------------------------------------------------
    $f .= '<form action="saveaccount.php" method="post">' . PHP_EOL;
    $f .= '<fieldset>' . PHP_EOL;
    // the superadmin user cannot change its own role
    if ($ROOT && !$self) {
        $f .= '<div class="fl mr">' . PHP_EOL;
        $f .= '<label for="role_id' . $rnd . '">role</label>' . PHP_EOL;
        // begin select ------------------------------------------------------------
        $f .= '<select id="role_id' . $rnd . '" name="role_id" class="text block">' . PHP_EOL;
        $f .= '<option value="0">...</option>' . PHP_EOL;
        foreach ($ROLES as $role) {
            $selected = $user['role_id'] == $role['id'] ? ' selected="selected"' : null;
            $f .= '<option value="' . $role['id'] . '"' . $selected . '>' . $role['name'] . '</option>' . PHP_EOL;
        }
        $f .= '</select>' . PHP_EOL;
        // end select --------------------------------------------------------------
        $f .= '</div>' . PHP_EOL;
    }
    $disabled = $ROOT || ($user['role_id'] != 1 || $self) ? null : ' disabled="disabled"';
    // diplay login
    if ($user === null) {
        $f .= '<div class="fl mr">' . PHP_EOL;
        $f .= '<label for="login' . $rnd . '">login</label>' . PHP_EOL;
        $f .= '<input type="text" id="login' . $rnd . '" name="login" class="text block"' . $disabled . ' />' . PHP_EOL;
        $f .= '</div>' . PHP_EOL;
    }
    // common fields
    $f .= '<div class="fl mr">' . PHP_EOL;
    $f .= '<label for="name' . $rnd . '">full name</label>' . PHP_EOL;
    $f .= '<input type="text" id="name' . $rnd . '" name="name" class="text block"' . $disabled . ' value="' . $user['name'] . '" />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    $f .= '<div class="fl mr">' . PHP_EOL;
    $f .= '<label for="email' . $rnd . '">email</label>' . PHP_EOL;
    $f .= '<input type="text" id="email' . $rnd . '" name="email" class="text block"' . $disabled . ' value="' . $user['email'] . '" />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    $f .= '<div class="fl mr">' . PHP_EOL;
    $f .= '<label for="website' . $rnd . '">website</label>' . PHP_EOL;
    $f .= '<input type="text" id="website' . $rnd . '" name="website" class="text block"' . $disabled . ' value="' . $user['website'] . '" />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    // user password prefix
    $display = $user === null ? "set" : "change";
    $f .= '<div class="fl mr">' . PHP_EOL;
    $f .= '<label for="pass1' . $rnd . '">' . $display . ' password</label>' . PHP_EOL;
    $f .= '<input type="password" id="pass1' . $rnd . '" name="pass1" class="text block"' . $disabled . ' />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    // password must be verified
    $f .= '<div class="fl mr">' . PHP_EOL;
    $f .= '<label for="pass2' . $rnd . '">retype password</label>' . PHP_EOL;
    $f .= '<input type="password" id="pass2' . $rnd . '" name="pass2" class="text block"' . $disabled . ' />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    $f .= '</fieldset>' . PHP_EOL;
    // float right
    $f .= '<div class="fr">' . PHP_EOL;
    $form = $user === null ? "create" : "manage";
    $f .= '<input type="hidden" name="form" value="' . $form . '" />' . PHP_EOL;
    // override user login if admin is going to update
    if ($user !== null) {
        $f .= '<input type="hidden" name="login" value="' . $user['login'] . '" />' . PHP_EOL;
    }
    $display = $user === null ? "Create" : "Update";
    $f .= '<input type="submit" class="button round"' . $disabled . ' value="' . $display . '" />' . PHP_EOL;
    $f .= '</div>' . PHP_EOL;
    $f .= '</form>' . PHP_EOL;
    // the superadmin user cannot delete itself
    if (is_root() && !$self && $user !== null) {
        $f .= '<form action="saveaccount.php" method="post">' . PHP_EOL;
        $f .= '<div class="fr">' . PHP_EOL;
        $f .= '<input type="hidden" name="login" value="' . $user['login'] . '" />' . PHP_EOL;
        $f .= '<input type="hidden" name="form" value="delete" />' . PHP_EOL;
        $f .= '<input type="submit" class="button round delete conf" value="Delete" />' . PHP_EOL;
        $f .= '</div>' . PHP_EOL;
        $f .= '</form>' . PHP_EOL;
    }
    // insert a small padding
    $f .= '<p class="clear"></p>' . PHP_EOL;
    if ($isAdmin) {
        $f .= '</div><!-- end wrapper -->' . PHP_EOL;
    }
    return $f;
}
Пример #4
0
    // sanitize (retrieve default value from settings.php)
    if (!$show) {
        $show = $defaultNumRecords;
    }
}
// set query limits
$start = $page * $show - $show;
$limit = "{$start},{$show}";
// query priority: filtered or default
$where = !empty($_SESSION['filterquery']) ? $_SESSION['filterquery'] : "1";
// will group by log id
$records = db_select_all(TBL_PREFIX . TBL_RECORDS, "*", $where . " GROUP BY " . $_SESSION['groupby'] . " ORDER BY id DESC, client_id, domain_id LIMIT {$limit}");
$items = [];
// if there are no more records, display message
if (!empty($records)) {
    if (check_systemversion("php", "5.2.0")) {
        $usePrettyDate = true;
        require_once SYS_DIR . 'prettyDate.php';
    }
    foreach ($records as $i => $r) {
        // wait for very recent visits
        $timeDiff = time() - strtotime($r['sess_date']);
        $receivingData = $timeDiff > 0 && $timeDiff < 30;
        $safeToDelete = $timeDiff > 3600;
        // delete logs with no mouse data
        if ($safeToDelete && !count(array_sanitize(explode(",", $r['coords_x'])))) {
            db_delete(TBL_PREFIX . TBL_RECORDS, "id='" . $r['id'] . "' LIMIT 1");
            continue;
        }
        if (!empty($_SESSION['groupby'])) {
            $browser = null;