<?php

// connect to geobytes web service
$ws = "http://www.geobytes.com/IpLocator.htm?GetLocation&template=xml.txt&ipaddress=" . base64_decode($IP);
$xml = get_remote_webpage($ws);
$doc = simplexml_load_string($xml['content']);
$lat = (double) $doc->latitude;
$lng = (double) $doc->longitude;
?>

<div id="map" class="center"></div>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?php 
echo GG_KEY;
?>
"></script>
<script type="text/javascript">
// <![CDATA[
google.load("maps", "2");
function initialize() {
  var map = new google.maps.Map2(document.getElementById("map"));
  var point = new google.maps.LatLng(<?php 
echo $lat;
?>
, <?php 
echo $lng;
?>
);
  map.setCenter(point, 6);
  var marker = new google.maps.Marker(point);
  map.addOverlay(marker);
  map.addControl(new GSmallMapControl());
Пример #2
0
    $data = explode('&', $HTTP_RAW_POST_DATA);
    foreach ($data as $val) {
        if (!empty($val)) {
            list($key, $value) = explode('=', $val);
            $_POST[$key] = urldecode($value);
        }
    }
}
require_once 'functions.php';
if (isset($_POST['compressed']) && $_POST['compressed']) {
    require_once 'libs/LZW.php';
    $_POST['xcoords'] = LZW::decompress($_POST['xcoords']);
    $_POST['ycoords'] = LZW::decompress($_POST['ycoords']);
    $_POST['clicks'] = LZW::decompress($_POST['clicks']);
    $_POST['elhovered'] = LZW::decompress($_POST['elhovered']);
    $_POST['elclicked'] = LZW::decompress($_POST['elclicked']);
}
/*
// add client id to POST data (the local server has the user cookies)
$_POST['client'] = get_client_id();
*/
$file = $_POST['action'] == "store" ? "store.php" : "append.php";
if (!empty($_POST['remote']) && $_POST['remote'] != "null") {
    // forward request to va server
    $request = get_remote_webpage($_POST['remote'] . '/api/' . $file, array(CURLOPT_COOKIE => $_POST['cookies'], CURLOPT_POST => true, CURLOPT_POSTFIELDS => $_POST));
    // at this point the remote server should return the DB log id
    echo $request['content'];
} else {
    //require_once '../config.php';
    require_once $file;
}
Пример #3
0
/** 
 * Checks if a new smt2 version is released via (smt) website.
 * @return  int   Server response: 1 (up to date), 2 (new version found), 3 (minor build released), 0 (connection error), -1 (parsing error) 
 */
function get_smt_releases()
{
    // connect to Web Service
    $ws = get_remote_webpage("http://smt.speedzinemedia.com/versioncheck.php?v=" . SMT_VERSION);
    return $ws['content'];
}
Пример #4
0
<?php

// check data first (exclude registered users)
if (empty($_POST) || isset($_COOKIE['smt-usr'])) {
    die(":(");
}
require_once '../config.php';
$URL = $_POST['url'];
// check proxy requests
$pattern = "proxy/index.php?url=";
if (strpos($URL, $pattern)) {
    list($remove, $URL) = explode($pattern, $URL);
    $URL = base64_decode($URL);
}
// get remote webpage
$request = get_remote_webpage($URL, array(CURLOPT_COOKIE => $_POST['cookies']));
$webpage = utf8_encode($request['content']);
// check request status
if ($request['errnum'] != CURLE_OK || $request['http_code'] != 200) {
    $webpage = error_webpage('<h1>Could not fetch page</h1><pre>' . print_r($request, true) . '</pre>');
    $parse = true;
} else {
    $cachedays = db_option(TBL_PREFIX . TBL_CMS, "cacheDays");
    // is cache enabled?
    if ($cachedays > 0) {
        // get the most recent version saved of this page
        $cachelog = db_select(TBL_PREFIX . TBL_CACHE, "id,UNIX_TIMESTAMP(saved) as savetime", "url='" . $URL . "' ORDER BY id DESC");
        // check if url exists on cache, and if it should be stored (again) on cache
        if ($cachelog && time() - $cachelog['savetime'] < $cachedays * 86400) {
            // get HTML log id
            $cache_id = $cachelog['id'];
Пример #5
0
// A fallback error page:
$errpage = '<h1>Page not found on cache!</h1>';
$errpage .= '<p>Error loading file <code>' . $htmlFile . '</code>, which is a snapshot of <code>' . $url . '</code></p>';
$errpage .= '<p>Some reasons for this issue include the following:</p>';
$errpage .= '<ol>';
$errpage .= '<li>Cache request could not be processed at the time.</li>';
$errpage .= '<li>The cache log was deleted.</li>';
$errpage .= '<li>The cache dir has been moved/renamed.</li>';
$errpage .= '</ol>';
$errpage .= '<p>As a fallback solution, mark the option <code>fetchOldUrl</code> in the <em>Customize</em> section and reload this page.</p>';
// parse HTML log
$file = CACHE_DIR . $htmlFile;
$doc = new DOMUtil();
if (db_option(TBL_PREFIX . TBL_CMS, "fetchOldUrl")) {
    // try to re-fetch page, if available
    $request = get_remote_webpage($url);
    $page = $request ? $request['content'] : error_webpage();
    // hide warnings when parsing non valid (X)HTML pages
    @$doc->loadHTML($page);
    remove_smt_scripts($doc);
} else {
    if (!is_file($file)) {
        // page not in cache and not fetched
        @$doc->loadHTML(error_webpage($errpage));
        remove_smt_scripts($doc);
    } else {
        // page in cache (smt scripts were already removed)
        @$doc->loadHTMLFile(utf8_decode($file));
    }
}
// include user data