Beispiel #1
0
function valdata($g, $must_be_20_chars = false)
{
    if (!isset($_GET[$g])) {
        die(track("Missing key: {$g}"));
    }
    if (!is_string($_GET[$g])) {
        die(track('Invalid types on one or more arguments'));
    }
    if ($must_be_20_chars && strlen($_GET[$g]) != 20) {
        die(track('Invalid length on ' . $g . ' argument'));
    }
    if (strlen($_GET[$g]) > 128) {
        //128 chars should really be enough
        die(track('Argument ' . $g . ' is too large to handle'));
    }
    return $_GET[$g];
}
Beispiel #2
0
function handle_click($data)
{
    if (!isset($data['c']) or empty($data['c']) or !isset($data['type'])) {
        exit;
    }
    if (MAD_CLICK_IMMEDIATE_REDIRECT) {
        ob_start();
        $size = ob_get_length();
        // send headers to tell the browser to close the connection
        redirect($data);
        header("Content-Length: {$size}");
        header('Connection: close');
        // flush all output
        ob_end_flush();
        ob_flush();
        flush();
        track($data);
    } else {
        track($data);
        redirect($data);
    }
}
Beispiel #3
0
function valdata($g, $fixed_size = false)
{
    if (!isset($_GET[$g])) {
        die(track('Invalid request, missing data'));
    }
    if (!is_string($_GET[$g])) {
        die(track('Invalid request, unknown data type'));
    }
    if ($fixed_size && strlen($_GET[$g]) != 20) {
        die(track('Invalid request, length on fixed argument not correct'));
    }
    if (strlen($_GET[$g]) > 80) {
        //128 chars should really be enough
        die(track('Request too long'));
    }
}
    switch ($type) {
        //Switch case for value of type
        case "upload":
            $response_array = upload();
            $response_array['status'] = $response_array['error'] != NULL ? 'error' : 'success';
            die(json_encode($response_array));
        case "convert":
            $response_array = convert();
            $response_array['status'] = 'success';
            die(json_encode($response_array));
        case "save":
            $response_array = save();
            $response_array['status'] = 'success';
            die(json_encode($response_array));
        case "track":
            $response_array = track();
            $response_array['status'] = 'success';
            die(json_encode($response_array));
        default:
            $response_array['status'] = 'error';
            $response_array['error'] = '404 Method not found';
            die(json_encode($response_array));
    }
}
function upload()
{
    $result;
    $filename;
    if ($_FILES['files']['error'] > 0) {
        $result["error"] = 'Error ' . json_encode($_FILES['files']['error']);
        return $result;
Beispiel #5
0
function dispatch($languages)
{
    global $base_path;
    global $request_path, $request_query;
    global $closing_time, $opening_time;
    global $track_visitor, $track_visitor_agent;
    $req = $base_path ? substr(request_uri(), strlen($base_path)) : request_uri();
    if ($track_visitor) {
        track($req, $track_visitor_agent);
    }
    $url = @parse_url($req);
    $path = isset($url['path']) ? trim(urldecode($url['path']), '/') : false;
    $query = isset($url['query']) ? $url['query'] : false;
    $request_query = $query;
    if (empty($path)) {
        $path = false;
    }
    /* site language */
    $p = $path ? explode('/', $path) : false;
    $lang = $p ? $p[0] : false;
    if ($lang && in_array($lang, $languages, true)) {
        array_shift($p);
        $path = implode('/', $p);
    } else {
        require_once 'locale.php';
        $lang = locale();
        if (!$lang or !in_array($lang, $languages, true)) {
            $lang = $languages[0];
        }
    }
    $request_path = $path ? $lang . '/' . $path : $lang;
    $action = $args = $params = false;
    if ($closing_time) {
        $action = 'error/serviceunavailable';
        $args = array($closing_time, $opening_time);
    } else {
        $r = route($path, $lang);
        if (!$r) {
            $action = 'error/notfound';
        } else {
            list($action, $args) = $r;
            if ($query) {
                $params = array();
                foreach (explode('&', $query) as $q) {
                    $p = explode('=', $q);
                    if (count($p) == 2) {
                        list($key, $value) = $p;
                        if ($key) {
                            $params[$key] = urldecode($value);
                        }
                    }
                }
            }
        }
    }
    $arglist = $args ? $params ? array_merge($args, $params) : $args : $params;
    run($action, $lang, $arglist);
}
Beispiel #6
0
        $pollCount++;
        // Draw the socket read a draw
        if ($tick_end - $tick_start < 2.0) {
            sleep(2);
        }
    }
}
do {
    // Check database
    if (!checkDB($DBH, $dbTables)) {
        echo '[DB-check] Table\'s do not exist in database "' . $dbAuth['dbname'] . '". Check the troubleshooting page.' . "\n";
        exit;
    }
    try {
        // Start the tracker
        track();
    } catch (Exception $e) {
        try {
            // Kill any event listeners
            foreach ($tracking_numbers as $number) {
                $wa->sendPresenceUnsubscription($number);
            }
        } catch (Exception $e) {
            // Connection closed, nevermind
        }
        // Update tracker session
        $end_tracker_session = $DBH->prepare('UPDATE tracker_history SET "end" = NOW() WHERE "end" IS NULL;');
        $end_tracker_session->execute();
        // End any running record where an user is online
        $end_user_session = $DBH->prepare('UPDATE status_history
											SET "end" = NOW() WHERE "end" IS NULL AND "status" = true;');
Beispiel #7
0
function trackUser($message)
{
    $fp = fopen('jammer_log.txt', 'a');
    fwrite($fp, $_SERVER[REMOTE_ADDR] . " " . date('Y-m-d H:i:s') . " " . $message . "\n");
    fclose($fp);
    $hit = track($_SERVER[REMOTE_ADDR]);
    return $hit;
}
Beispiel #8
0
            case 1:
                $link = 'http://www.meilimei.com/manage/yishi/detail/' . $row->uid . '.html';
                break;
            default:
                $link = 'http://www.meilimei.com/manage/yiyuan/detail/' . $row->uid . '.html';
                break;
        }
        echo ' <ul>
                                	 <li style="width:15%"><a href="' . $link . '">' . $row->name . '</a></li>  
                                     <li style="width:15%">' . $row->alias . '</li> 
									 <li style="width:10%">' . $row->ip . '</li> 
									 <li style="width:20%">' . $row->addr . '</li>  
									 <li style="width:10%">' . $row->system . '</li> 
									 <li style="width:8%">' . $row->browser . '</li> 
									 <li style="width:13%">' . date('Y-m-d H:i:s', $row->cdate) . '</li> 
									 <li style="width:5%">' . track($this->db, $row->uid) . '</li> 
									 <div class="clear" style="clear:both;"></div>
                                </ul>';
    } else {
        echo ' <ul style="background:#FDD">
                                	 <li style="width:15%"><a href="' . site_url('manage/logtrack?email=' . $row->name . '&submit=1') . '">' . $row->name . '</a></li>  
                                     <li style="width:15%"></li> 
									 <li style="width:10%">' . $row->ip . '</li> 
									 <li style="width:20%">' . $row->addr . '</li>  
									 <li style="width:10%">' . $row->system . '</li> 
									 <li style="width:8%">' . $row->browser . '</li> 
									 <li style="width:13%">' . date('Y-m-d H:i:s', $row->cdate) . '</li> 
									 <div class="clear" style="clear:both;"></div>
                                </ul>';
    }
}
Beispiel #9
0
<?php

date_default_timezone_set('UTC');
$id = trim(key($_REQUEST), '/');
$logFile = "./" . basename("./{$id}.log");
$trackingEnabled = file_exists($logFile);
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        $trackingEnabled ? status(204) : status(404);
        break;
    case 'POST':
        if (!$trackingEnabled) {
            status(404);
        }
        track($_POST);
        status(201);
        break;
    default:
        status(400);
        break;
}
function status($code)
{
    header("HTTP/1.1 {$code}", true, $code);
    exit;
}
function track($values)
{
    global $logFile;
    $info = array();
    array_walk($values, function ($value, $key, $info) {
    # if none of these exist, that's a 503 Service Unavailable
    $imgdir = '..' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
    # $campaign-based image?
    foreach ($exts as $ext) {
        if (file_exists("{$imgdir}{$campaign}.{$ext}") and is_readable("{$imgdir}{$campaign}.{$ext}")) {
            return "{$imgdir}{$campaign}.{$ext}";
        }
    }
    # default.$ext?
    foreach ($exts as $ext) {
        if (file_exists("{$imgdir}default.{$ext}") and is_readable("{$imgdir}default.{$ext}")) {
            return "{$imgdir}default.{$ext}";
        }
    }
    # no file found! abort abort abort!
    header("HTTP/1.0 503 Service Unavailable");
    exit(0);
}
# default campaign and keyword
$GLOBALS['campaign'] = $GLOBALS['config']['default_campaign'];
$GLOBALS['keyword'] = "";
# get the actual campaign data
campaign_data();
# build campaign image uri
$GLOBALS['campaign_image'] = campaign_image($GLOBALS['campaign'], $GLOBALS['config']['image_extensions']);
# track the page view!
track($GLOBALS['campaign'], $GLOBALS['keyword']);
# set the headers
headers($GLOBALS['campaign_image']);
# return the image
readfile($GLOBALS['campaign_image']);
Beispiel #11
0
$fren_updates_key = "fren:v1:updates";
$fren_updates = mem_get($fren_updates_key);
if (!$fren_updates) {
    $data_orig = $yahoo_session->query('select * from social.updates.search where source="APP.7BNRkt42" limit 10');
    $fren_updates = $data_orig->query->results->update;
    mem_set($fren_updates_key, $fren_updates, 3600);
}
$leaders = doEverything($yahoo_session);
foreach ($leaders as $leader) {
    $me = $leader;
    break;
}
$badge_names = array("agg.twitter" => "Tweetoo", "avatars" => "Beharupia", "buzz" => "Buzzooka", "y.mybloglog" => "BloggY!", "socialite" => "Socialite", "newbie1" => "Newbie");
$badge_desc = array("agg.twitter" => "You've shared 5 twitter updates!", "avatars" => "You've creating a Yahoo! avatar", "buzz" => "You've buzed up 3 times", "y.mybloglog" => "You've sharing 10 blog updates", "socialite" => "You've updates from 8 different sources", "newbie1" => "Congrats! On sharing your updates");
krsort($leaders);
track($me["nickname"], $me["guid"], $me["count"]);
// $me=array("count"=>20);
?>
<style>
h1 {
color:#E57F3E;
font-size:18px;
font-weight:bold;
}
#maincolumn{float:left;margin-left:15px;width:270px;}
a {color:#0077BB;}
h2  {
background-color:#FFFFFF;
border-bottom:2px solid #5A7992;
clear:both;
color:#5A7992;