Exemplo n.º 1
0
function f_setinput($post_data, $spec = array())
{
    //$post_data has action key, $spec is initialized
    if ($spec["cleanneed"]) {
        $post_data = f_getflds($spec["need"], $post_data);
    }
    $post_data = f_convertinp(f_add_fixed_values(f_mapkeys($post_data, $spec["keymap"]), $spec["fixed"]), gget("convert", "todb"), $spec["conv"]);
    if ($spec["funcs"] !== null) {
        $post_data = call_user_func(getval($spec["funcs"], gi("funcs")), $post_data);
    }
    $spec["data"] = $post_data;
    foreach (array("insert", "match") as $i) {
        setift($spec[$i], array_keys($spec["data"]), $spec[$i] === "all");
        $spec["autodata"] = f_getflds($spec[$i], $spec["data"]);
    }
    return $spec;
}
Exemplo n.º 2
0
function recv()
{
    global $_SERVER;
    $ip = $_SERVER['REMOTE_ADDR'];
    # get data
    $type = g('type', 'pageview');
    $uid = readSecureId(g('u', ''), "userid");
    if ($uid == -1) {
        return;
    }
    $location = trim(g('l', ''));
    if (strlen($location) == 0) {
        return;
    }
    $referer = trim(g('r', ''));
    $width = gi('w', 0);
    $height = gi('h', 0);
    $historylen = gi('hl', 0);
    $agent = g('a', '');
    $cookies = strtolower(trim(g('c', 'na')));
    if ($cookies != 'na' && $cookies != 'y' && $cookies != 'n') {
        $cookies = 'na';
    }
    # split domain info
    $url = parseurl($location);
    if ($url === false) {
        return;
    }
    $time = time();
    $ispro = isPro($uid);
    $eventid = LOG_EVENT_PAGEVIEW;
    if ($type == 'adclick') {
        $eventid = LOG_EVENT_ADCLICK;
    }
    if (!$ispro && $eventid != LOG_EVENT_PAGEVIEW) {
        return;
    }
    # Log the visit. We assign a new event ID to every logged event.
    # Note that PHP running on 32 bit systems will overflow the ID soon
    # or later.
    $r = redisLink();
    $logid = $r->incr("global:nextLogId");
    $aux = array("time" => $time, "user_id" => $uid, "event_id" => $eventid, "location" => $location, "proto" => $url['proto'], "domain" => $url['domain'], "path" => $url['path'], "query" => $url['query'], "ref" => $referer, "swidth" => $width, "sheight" => $height, "cookies" => $cookies, "ip" => $ip, "agent" => $agent, "historylen" => $historylen, "id" => $logid);
    # Insert new
    $r->push("last:{$uid}", serialize($aux), false);
    # History length is different for PRO / non PRO user.
    $r->ltrim("last:{$uid}", 0, $ispro ? 1000 : 50);
    if ($eventid != LOG_EVENT_PAGEVIEW) {
        return;
    }
    # Update stats
    $nv = gi('nv', 0);
    $rv = gi('rv', 0);
    $t = time();
    $t = $t - $t % (3600 * 24);
    # Update unique visits
    if ($nv) {
        $r->incr("day:uv:{$uid}:{$t}");
        if ($rv) {
            $r->incr("day:rv:{$uid}:{$t}");
        }
    }
    $r->incr("day:pv:{$uid}:{$t}");
}
Exemplo n.º 3
0
 public static function msg($to, $sub, $body, $add = array())
 {
     //to be replace
     Fun::dummymm($to, $sub, $body, Fun::mergeifunset($add, array("file" => "data/msgf")));
     if (gi("isrealmsg")) {
         return Funs::sendmsg($to, $body);
     }
 }
Exemplo n.º 4
0
<?php

load_view("template/top.php", array("css" => array("css/custom-homestyle-v2.css")));
load_view("template/navbarnew.php", $inp);
?>

<div id="index-banner" class="parallax-container">
  <div class="section no-pad-bot">
    <div class="container">
      <div class="row "  >
        <div class="col s12">
          <h1 class="header center white-text">
            <?php 
echo gi("myname");
?>
          </h1>
        </div>
        <div class="col s12">
          <div class="rw-words-1">
            <h5 class="center">
              Get an Expert Adviser for
              <b>
                Any Sports, Any Time
              </b>
              !
            </h5>
            <h5 class="center">
              Be
              <b>
                Better
              </b>
Exemplo n.º 5
0
  <!-- Footer -->
  <footer class="page-footer teal">
    <div class="container ">
      <div class="row">
        <div class="col l4 s12">
          <h5 class="white-text"><?php 
gi("myname");
?>
</h5>
          <div class="grey-text text-lighten-3" ><i class="mdi-communication-email"></i> <?php 
echo gi("myemail");
?>
</div>
        </div>
      </div>
    </div>
    <div class="footer-copyright">
      <div class="container">
      &copy; Copyright 2015 <?php 
gi("myname");
?>
      <a class="grey-text text-lighten-4 right" href="#!"><?php 
echo gi("website");
?>
</a>
      </div>
    </div>
  </footer>
Exemplo n.º 6
0
</head>
<body>
<script type="text/javascript">
function changeperiod() {
    var s = $('graphperiod');
    var p = s.options[s.selectedIndex].value;
    var l = $('logscale').checked ? "1" : "0";
    window.location.href="/trendsframe.php?period="+mfxEscape(p)+"&logscale="+l;
}
</script>
<div id="trendsctrl">
<h2>Control</h2>
<a href="#" onclick="window.location.reload()">refresh graphs</a><br/>
<select id="graphperiod" onchange="changeperiod()">
<?php 
$logscale = gi("logscale", 0);
$period = g("period", "15days");
$periods = array();
$periods[] = "days";
$periods[] = "weeks";
$periods[] = "months";
$periods[] = "years";
foreach ($periods as $p) {
    $selected = $period == $p ? " selected " : "";
    echo "<option " . $selected . "value=\"{$p}\">{$p}</option>\n";
}
?>
</select><br/>
<input onchange="changeperiod()" type="checkbox" id="logscale" value="1" <?php 
if ($logscale) {
    echo "checked";
Exemplo n.º 7
0
$lastvisit = $r->lindex("last:" . userId(), -1);
$statusok = false;
if ($lastvisit) {
    $row = unserialize($lastvisit);
    if (time() - $row['time'] < 3600 * 24) {
        $statusok = true;
    }
}
if ($statusok) {
    echo "We are correctly receiving data";
} else {
    echo "We are NOT receiving data, make sure to install the javascript tag in your web site";
}
$excludechecked = userExcludeMyVisits() ? "checked" : "";
$showuseragent = userShowUserAgent() ? "checked" : "";
$savedhtml = gi("s", 0) ? ' <span id="saved" style="color:red">(saved)</span>' : '';
?>
<h3>Options<?php 
echo $savedhtml;
?>
</h3>
<form method="post" action="usercode.php" id="optionsform">
Don't log my own visits <input type="checkbox" name="excludemyvisits" value="1" <?php 
echo $excludechecked;
?>
><br/><br/>
Show clients user agent <input type="checkbox" name="showuseragent" value="1" <?php 
echo $showuseragent;
?>
><br/><br/>
<input type="submit" name="saveoptions" value="Save options">
Exemplo n.º 8
0
function poll()
{
    $numres = 1;
    $r = redisLink();
    $uid = reqUserId();
    $minid = gi("minid", 0);
    $proto = gi("proto", 1);
    $loadhistory = 0;
    if ($minid == 0) {
        # First client request. Just return the latest entry
        $latest = unserialize($r->lindex("last:{$uid}", 0));
        $minid = $latest['id'];
    } else {
        if ($minid < 0) {
            # minid < 0 means: load history, with abs(minid) elements
            $numres = abs($minid);
            if ($numres > 1000) {
                $numres = 1000;
            }
            $loadhistory = 1;
        }
    }
    $rows = $r->lrange("last:{$uid}", 0, $numres - 1);
    # Handle free accounts timeouts.
    # NOTE: this is actually disabled, left here for historical reasons
    # and because the javascript still handles it.
    $ispro = isPro($uid);
    if (0 && !$ispro) {
        $startpoll = $r->get("startpoll:{$uid}");
        if (!$startpoll) {
            $r->set("startpoll:{$uid}", time());
        } else {
            $delta = time() - $r->get("startpoll:{$uid}");
            if ($delta > FREE_MAXTIME + FREE_WAIT) {
                $r->delete("startpoll:{$uid}");
            } else {
                if ($delta > FREE_MAXTIME) {
                    echo "TRYLATER:" . floor(1 + (FREE_MAXTIME + FREE_WAIT - $delta) / 60);
                    exit;
                }
            }
        }
    }
    # Empty list?
    if (count($rows) == 0) {
        echo "NODATA";
        exit;
    }
    # Check if even the most recent element (the first one)
    # is still too old. If so, no new data to return.
    $latest = unserialize($rows[0]);
    if ($latest['id'] < $minid) {
        echo "NODATA";
        exit;
    }
    # Try to get all the data required. Up to 50 elements for request
    while (!$loadhistory) {
        $oldest = unserialize($rows[count($rows) - 1]);
        if ($oldest['id'] > $minid && $numres < 50) {
            # We need more data
            $numres = ($numres + 1) * 2;
            if ($numres > 50) {
                $numres = 50;
            }
            $rows = $r->lrange("last:{$uid}", 0, $numres - 1);
        } else {
            break;
        }
    }
    # Ok now reverse the array to sort ascending and return data to ajax.
    $rows = array_reverse($rows);
    $gi = geoip_open("geoipdata/GeoIP.dat", GEOIP_STANDARD);
    foreach ($rows as $srow) {
        $row = unserialize($srow);
        if ($row['id'] < $minid) {
            continue;
        }
        $keys = array("time", "location", "domain", "ref", "swidth", "sheight", "cookies", "ip", "agent", "historylen");
        $aux = array();
        foreach ($keys as $k) {
            $aux[$k] = $row[$k];
        }
        $aux['country'] = geoip_country_name_by_addr($gi, $aux['ip']);
        $aux['type'] = 'pageview';
        # At some point LLOOGG supported the ability to display user clicks
        # adsense ADs. Now the javascript we inject no longer support this
        # but the support inside LLOOGG itself remains.
        if ($row['event_id'] == LOG_EVENT_ADCLICK) {
            $aux['type'] = 'adclick';
        }
        $t[] = $aux;
        if ($row['id'] > $maxid) {
            $maxid = $row['id'];
        }
    }
    geoip_close($gi);
    $t[] = $maxid + 1;
    if ($proto >= 2) {
        $t[] = logTodayVisitors();
        $t[] = logTodayPageviews();
    }
    $json = new Services_JSON();
    $output = $json->encode($t);
    echo $output;
}
Exemplo n.º 9
0
require "../lib.php";
if (g('username') === false || g('pass') === false || g('rememberme') === false) {
    echo "ERR";
    exit;
}
$user = g('username');
$pass = g('pass');
$r = redisLink();
$userid = $r->get("username:{$user}:id");
if (!$userid) {
    echo "ERR";
    exit;
}
if (bcrypt_check($pass, $r->get("uid:{$userid}:hashpass"))) {
    $secret = $r->get("uid:{$userid}:auth");
    if (gi('rememberme', 0) == 1) {
        $now = time() + 3600 * 24 * 365;
        setCookie("secret", $secret, $now, "/");
        setCookie("secret", $secret, $now, "/", Config("domain"));
        setCookie("secret", $secret, $now, "/", "." . Config("domain"));
    } else {
        // Just for this session.
        setCookie("secret", $secret, 0, "/");
        setCookie("secret", $secret, 0, "/", Config("domain"));
        setCookie("secret", $secret, 0, "/", "." . Config("domain"));
    }
    echo "OK:AUTHENTICATED";
} else {
    echo "ERR";
}