%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/309157/root/data/bordel/ingress/
Upload File :
Create Path :
Current File : //proc/309157/root/data/bordel/ingress/portals.php

<?php
	require("config.php");
	//set_time_limit(300);
function playerNameResolve($pname)
{
	return $pname;
}

//error_reporting(0);
	header("Content-type: text/plain");
	$db = new mysqli($srv, $usr, $pwd, $dbname);
	$res = $db->query("select time from updated");
	$res = $res->fetch_array()[0];
	$portals = array();

	$sources = array(
		'curl http://www.ingress.com/rpc/dashboard.getThinnedEntitiesV2 --compressed --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0" --cookie "'.$ing_cookie.'" --cookie-jar "ingress_intel_chat.cookie.jar" --referer "http://www.ingress.com/intel" --header "X-CSRFToken: '.$ing_csrf.'" --header "X-Requested-With: XMLHttpRequest" --data-binary "{\"minLevelOfDetail\":3,\"boundsParamsList\":[{\"id\":\"12_2233_1402\",\"minLatE6\":49210420,\"minLngE6\":16259766,\"maxLatE6\":49267805,\"maxLngE6\":16347656,\"qk\":\"12_2233_1402\"},{\"id\":\"12_2237_1402\",\"minLatE6\":49210420,\"minLngE6\":16611328,\"maxLatE6\":49267805,\"maxLngE6\":16699219,\"qk\":\"12_2237_1402\"},{\"id\":\"12_2234_1403\",\"minLatE6\":49152970,\"minLngE6\":16347656,\"maxLatE6\":49210420,\"maxLngE6\":16435547,\"qk\":\"12_2234_1403\"},{\"id\":\"12_2238_1403\",\"minLatE6\":49152970,\"minLngE6\":16699219,\"maxLatE6\":49210420,\"maxLngE6\":16787109,\"qk\":\"12_2238_1403\"},{\"id\":\"12_2235_1404\",\"minLatE6\":49095452,\"minLngE6\":16435547,\"maxLatE6\":49152970,\"maxLngE6\":16523438,\"qk\":\"12_2235_1404\"},{\"id\":\"12_2239_1404\",\"minLatE6\":49095452,\"minLngE6\":16787109,\"maxLatE6\":49152970,\"maxLngE6\":16875000,\"qk\":\"12_2239_1404\"}],\"method\":\"dashboard.getThinnedEntitiesV2\"}"', 
		'curl http://www.ingress.com/rpc/dashboard.getThinnedEntitiesV2 --compressed --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0" --cookie "'.$ing_cookie.'" --cookie-jar "ingress_intel_chat.cookie.jar" --referer "http://www.ingress.com/intel" --header "X-CSRFToken: '.$ing_csrf.'" --header "X-Requested-With: XMLHttpRequest" --data-binary "{\"minLevelOfDetail\":3,\"boundsParamsList\":[{\"id\":\"12_2234_1402\",\"minLatE6\":49210420,\"minLngE6\":16347656,\"maxLatE6\":49267805,\"maxLngE6\":16435547,\"qk\":\"12_2234_1402\"},{\"id\":\"12_2238_1402\",\"minLatE6\":49210420,\"minLngE6\":16699219,\"maxLatE6\":49267805,\"maxLngE6\":16787109,\"qk\":\"12_2238_1402\"},{\"id\":\"12_2235_1403\",\"minLatE6\":49152970,\"minLngE6\":16435547,\"maxLatE6\":49210420,\"maxLngE6\":16523438,\"qk\":\"12_2235_1403\"},{\"id\":\"12_2239_1403\",\"minLatE6\":49152970,\"minLngE6\":16787109,\"maxLatE6\":49210420,\"maxLngE6\":16875000,\"qk\":\"12_2239_1403\"},{\"id\":\"12_2236_1404\",\"minLatE6\":49095452,\"minLngE6\":16523438,\"maxLatE6\":49152970,\"maxLngE6\":16611328,\"qk\":\"12_2236_1404\"}],\"method\":\"dashboard.getThinnedEntitiesV2\"}"',
		'curl http://www.ingress.com/rpc/dashboard.getThinnedEntitiesV2 --compressed --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0" --cookie "'.$ing_cookie.'" --cookie-jar "ingress_intel_chat.cookie.jar" --referer "http://www.ingress.com/intel" --header "X-CSRFToken: '.$ing_csrf.'" --header "X-Requested-With: XMLHttpRequest" --data-binary "{\"minLevelOfDetail\":3,\"boundsParamsList\":[{\"id\":\"12_2235_1402\",\"minLatE6\":49210420,\"minLngE6\":16435547,\"maxLatE6\":49267805,\"maxLngE6\":16523438,\"qk\":\"12_2235_1402\"},{\"id\":\"12_2239_1402\",\"minLatE6\":49210420,\"minLngE6\":16787109,\"maxLatE6\":49267805,\"maxLngE6\":16875000,\"qk\":\"12_2239_1402\"},{\"id\":\"12_2236_1403\",\"minLatE6\":49152970,\"minLngE6\":16523438,\"maxLatE6\":49210420,\"maxLngE6\":16611328,\"qk\":\"12_2236_1403\"},{\"id\":\"12_2233_1404\",\"minLatE6\":49095452,\"minLngE6\":16259766,\"maxLatE6\":49152970,\"maxLngE6\":16347656,\"qk\":\"12_2233_1404\"},{\"id\":\"12_2237_1404\",\"minLatE6\":49095452,\"minLngE6\":16611328,\"maxLatE6\":49152970,\"maxLngE6\":16699219,\"qk\":\"12_2237_1404\"}],\"method\":\"dashboard.getThinnedEntitiesV2\"}"',
		'curl http://www.ingress.com/rpc/dashboard.getThinnedEntitiesV2 --compressed --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0" --cookie "'.$ing_cookie.'" --cookie-jar "ingress_intel_chat.cookie.jar" --referer "http://www.ingress.com/intel" --header "X-CSRFToken: '.$ing_csrf.'" --header "X-Requested-With: XMLHttpRequest" --data-binary "{\"minLevelOfDetail\":3,\"boundsParamsList\":[{\"id\":\"12_2236_1402\",\"minLatE6\":49210420,\"minLngE6\":16523438,\"maxLatE6\":49267805,\"maxLngE6\":16611328,\"qk\":\"12_2236_1402\"},{\"id\":\"12_2233_1403\",\"minLatE6\":49152970,\"minLngE6\":16259766,\"maxLatE6\":49210420,\"maxLngE6\":16347656,\"qk\":\"12_2233_1403\"},{\"id\":\"12_2237_1403\",\"minLatE6\":49152970,\"minLngE6\":16611328,\"maxLatE6\":49210420,\"maxLngE6\":16699219,\"qk\":\"12_2237_1403\"},{\"id\":\"12_2234_1404\",\"minLatE6\":49095452,\"minLngE6\":16347656,\"maxLatE6\":49152970,\"maxLngE6\":16435547,\"qk\":\"12_2234_1404\"},{\"id\":\"12_2238_1404\",\"minLatE6\":49095452,\"minLngE6\":16699219,\"maxLatE6\":49152970,\"maxLngE6\":16787109,\"qk\":\"12_2238_1404\"}],\"method\":\"dashboard.getThinnedEntitiesV2\"}"' 
	);

	if(time() > $res+300)
	{
		$db->query("truncate table portal");
		foreach($sources as $src)
		{
			$entities = false;
			$i = 0;
			while((!$entities || !isset($dashboard->result)) && $i < 2)
			{
				$i++;
				$data = "";
				$input = popen($src, "r");
				while(!feof($input))
				{
					$data .= fgets($input, 64*1024);
				}
				pclose($input);
				//print_r($data);
				$entities = json_decode($data);
			}
			foreach ($entities->result->map as $tile)
			{
				foreach ($tile->gameEntities as $entity) 
				{
					if(!isset($entity[2]->portalV2)) continue;
					$dist = 0;
					$lvl = 0;
					$resNum = 0;
					$topRes = 0;
					$energy = 0;
					foreach ($entity[2]->resonatorArray->resonators as $resonator) 
					{
						if(!$resonator) continue;
						$resNum++;
						$dist += $resonator->distanceToPortal;
						$lvl += $resonator->level;
						$topRes = $topRes < $resonator->level ? $resonator->level : $topRes;
						$energy += $resonator->energyTotal;
					}
					$portal = new stdClass();
					$portal->level = $lvl / 8;
					$portal->dist = $dist / $resNum;
					$portal->topResonator = $topRes;
					$portal->energy = $energy;
					$portal->name = str_replace("'", "\\'", $entity[2]->portalV2->descriptiveText->TITLE);
					$portal->address = str_replace("'", "\\'", $entity[2]->portalV2->descriptiveText->ADDRESS);
					$portal->owner = playerNameResolve($entity[2]->captured->capturingPlayerId);
					$portal->faction = $entity[2]->controllingTeam->team;
					$portal->lat = $entity[2]->locationE6->latE6;
					$portal->lng = $entity[2]->locationE6->lngE6;
					$db->query("insert into portal(level, distance, topResonator, energy, name, address, owner, faction, latitude, longitude) values(".$portal->level.", ".$portal->dist.", ".$portal->topResonator.", ".$portal->energy.", '".$portal->name."', '".$portal->address."', '".$portal->owner."', '".$portal->faction."', ".$portal->lat.", ".$portal->lng.")");
					//$portals[] = $portal;
					header("X-Updated: now");
				}
			}
		}
		$db->query('update `updated` set `time`='.time());
	}
	else
	{
		header("X-Updated: ".(time()-$res)." seconds ago");
	}

	if($_GET['what'] == 'resonator' && $_GET['precise'] == 'false')
		$res = $db->query('SELECT level, distance, topResonator, energy, name, address, owner, faction, latitude, longitude FROM portal where topResonator >= '.mysql_real_escape_string($_GET['level']));
	if($_GET['what'] == 'resonator' && $_GET['precise'] == 'true')
		$res = $db->query('SELECT level, distance, topResonator, energy, name, address, owner, faction, latitude, longitude FROM portal where topResonator = '.mysql_real_escape_string($_GET['level']));
	if($_GET['what'] == 'portal' && $_GET['precise'] == 'false')
		$res = $db->query('SELECT level, distance, topResonator, energy, name, address, owner, faction, latitude, longitude FROM portal where level >= '.mysql_real_escape_string($_GET['level']));
	if($_GET['what'] == 'portal' && $_GET['precise'] == 'true')
		$res = $db->query('SELECT level, distance, topResonator, energy, name, address, owner, faction, latitude, longitude FROM portal where level = '.mysql_real_escape_string($_GET['level']));

	while($r = $res->fetch_array())
	{
		$portal = new stdClass();
		$portal->level = $r[0];
		$portal->distance = $r[1];
		$portal->topResonator = $r[2];
		$portal->energy = $r[3];
		$portal->name = $r[4];
		$portal->address = $r[5];
		$portal->owner = $r[6];
		$portal->faction = $r[7];
		$portal->latitude = $r[8];
		$portal->longitude = $r[9];
		$portals[] = $portal;
	}
	
	echo json_encode($portals, JSON_PRETTY_PRINT);
?>

Zerion Mini Shell 1.0