Пример #1
0
<?php

require_once '../lib/header_ajax.php';
require_once '../lib/lib_morph_pools.php';
try {
    if (!isset($_POST['id']) || !isset($_POST['type'])) {
        throw new UnexpectedValueException();
    }
    log_click($_POST['id'], $_POST['type']);
} catch (Exception $e) {
    $result['error'] = 1;
}
log_timing(true);
die(json_encode($result));
Пример #2
0
* @param $cookie must be TRUE, if cookies are enabled
*/
function initsession($cookie)
{
    $_SESSION['nocookie'] = !$cookie;
    $_SESSION['nojavascript'] = true;
    $_SESSION['arrive'] = time();
    $_SESSION['lastclick'] = $_SESSION['arrive'];
    $_SESSION['click'] = 0;
    $_SESSION['first'] = false;
}
######################## LOG QUERY ########################
if ($_SESSION['nocookie'] === false && $_SESSION['first'] === false) {
    // TODO Át kéne tenni a releváns oldalakra
    $now = time();
    log_click($_SERVER['PHP_SELF'] . '?ns&' . http_build_query($_GET), ++$_SESSION['click'], $now - $_SESSION['arrive'], $now - $_SESSION['lastclick']);
    $_SESSION['lastclick'] = $now;
}
if (!isset($_SESSION['arrive'])) {
    $a = $_SERVER["REMOTE_ADDR"];
    if ($a != "193.225.109.57") {
        //monitoring kihagyasa
        $h = gethostbyaddr($a);
        $ts = date("YmdHis");
        $fh = fopen("newcounter.dat", "a");
        fwrite($fh, $ts . ":" . $a . ":" . $h . "\n");
        fclose($fh);
        $f = fopen("szamol.dat", "r");
        $ssz = fgets($f, 1024);
        $ssz += 1;
        fclose($f);