Beispiel #1
0
function redirect($url, $msg, $second = 0, $o = true)
{
    sendHeader();
    $str = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="refresh" content="' . $second . ';URL=' . $url . '"></head><body>' . $msg . '</body></html>';
    if ($o) {
        echo $str;
        exit;
    }
    return $str;
}
Beispiel #2
0
<?php

define('CK', 1);
require_once 'global.php';
if (GetServer('HTTP_IF_MODIFIED_SINCE') || GetServer('HTTP_IF_NONE_MATCH') || empty($_COOKIE) && !$pwServer['HTTP_USER_AGENT']) {
    sendHeader('304');
    exit;
}
if ($_GET['admin']) {
    $db_ckpath = '/';
    $db_ckdomain = '';
}
header('Pragma:no-cache');
header('Cache-control:no-cache');
class CkCode
{
    var $width;
    var $height;
    var $num;
    var $style;
    var $gdtype;
    function CkCode()
    {
        list($w, $h, $n) = explode("\t", $GLOBALS['db_gdsize']);
        (!is_numeric($w) || $w < 50 || $w > 200) && ($w = 150);
        (!is_numeric($h) || $h < 20 || $h > 80) && ($h = 60);
        (!is_numeric($n) || $n < 1) && ($n = 4);
        $this->width = $w;
        $this->height = $h;
        $this->num = (int) $n;
        $this->style = $GLOBALS['db_gdstyle'];
Beispiel #3
0
        sendHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        sendHeader('Content-Type: application/javascript; charset=UTF-8');
        if ($piwikJs = file_get_contents($PIWIK_URL . 'piwik.js')) {
            echo $piwikJs;
        } else {
            sendHeader($_SERVER['SERVER_PROTOCOL'] . '505 Internal server error');
        }
    }
    exit;
}
@ini_set('magic_quotes_runtime', 0);
// 2) PIWIK.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik
$url = sprintf("%spiwik.php?cip=%s&token_auth=%s&", $PIWIK_URL, getVisitIp(), $TOKEN_AUTH);
foreach ($_GET as $key => $value) {
    $url .= urlencode($key) . '=' . urlencode($value) . '&';
}
sendHeader("Content-Type: image/gif");
$stream_options = array('http' => array('user_agent' => arrayValue($_SERVER, 'HTTP_USER_AGENT', ''), 'header' => sprintf("Accept-Language: %s\r\n", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))), 'timeout' => $timeout));
$ctx = stream_context_create($stream_options);
echo file_get_contents($url, 0, $ctx);
function getVisitIp()
{
    $matchIp = '/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/';
    $ipKeys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_CF_CONNECTING_IP');
    foreach ($ipKeys as $ipKey) {
        if (isset($_SERVER[$ipKey]) && preg_match($matchIp, $_SERVER[$ipKey])) {
            return $_SERVER[$ipKey];
        }
    }
    return arrayValue($_SERVER, 'REMOTE_ADDR');
}
    exit(0);
}
$boundary = "cutHere";
function sendHeader()
{
    global $boundary;
    echo "--{$boundary}\r\n";
    echo "Content-Type: text/html\r\n\r\n";
    flush();
}
header("Content-Type: multipart/x-mixed-replace; boundary={$boundary}");
// generate some padding to work around CFNetwork handling of multipart data
$padding = "aa";
for ($i = 0; $i < 10; $i++) {
    $padding .= $padding;
}
sendHeader();
ob_end_flush();
echo "test html\n";
echo "<!-- {$padding} -->";
flush();
sendHeader();
echo "second html";
echo "<script>parent.childLoaded()</script>";
echo "<!-- {$padding} -->";
flush();
sendHeader();
echo "third html";
echo "<!-- {$padding} -->";
flush();
usleep(20 * 1000000);