PlanetSide Universe - View Single Post - Post your tools here
View Single Post
Old 2013-04-02, 04:10 AM   [Ignore Me] #32
arrmed
Private
 
Re: Post your tools here


Many thanks to Sinjhin, I based this PHP script off his work.

Shows online Members of your outfit sorted by battle rank:
http://framephonic.com/membersOnline.php

Code:
<html>
<head>
<title>Online PCYS members</title>
</head>
<body>
<p><h3>Online Now:</h3></p>
<?php
	$jsonOutfit = file_get_contents("http://census.soe.com/get/ps2-beta/outfit?alias=PCYS&c:resolve=member_online_status");
	$aearray = json_decode($jsonOutfit, true);
	$outfit_list = $aearray["outfit_list"];
	$members = $outfit_list[0]["members"];
	$memberIDs;
	$memberData;
	$memberIDsOnline;
	$memberSpecifics;
	$onlineCount = 0;
	
	date_default_timezone_set('America/Vancouver');
	

		foreach($members as $key => $value)
	{
		//echo "Key: $key; Value: $value<br />\n";
		if ($value["online_status"] == "1") {
		  $onlineCount++;
		$memberIDsOnline[$key] = $value["character_id"];
		}
	}
	
	foreach($memberIDsOnline as $key => $value)
	{
		$query = "http://census.soe.com/get/ps2-beta/character/{$value}?c:show=name.first,experience.rank";
		$memberData[$value] = json_decode(file_get_contents($query), true);
	}
	
	foreach($memberData as $key => $value)
	{
		$memberSpecifics[$key] = array("ID" => $key, "battle_rank" =>  $value["character_list"][0]["experience"][0]["rank"], 
						"name" => $value["character_list"][0]["name"]["first"]);
	}
	
	//var_dump($memberData);
	
	function cmp($b, $a)
	{
           if ($a["battle_rank"] == $b["battle_rank"])
	{
              return 0;
}
	    return ($a["battle_rank"] < $b["battle_rank"]) ? -1 : 1;
	}
	
	usort($memberSpecifics, "cmp");
	
	echo "<table border=1>";
	echo "<tr><td><b>Name</b></td><td><b>Battle Rank</b></td></tr>";
	foreach($memberSpecifics as $key => $value)
	{
		if($value["name"] == true)
		{
			echo "<tr>";

			echo "<td>{$value['name']} </td><td> {$value['battle_rank']} </td>";
			//echo "</br>{$value['name']}';
			echo "</tr>";
		}
	}
	echo "</table>";
?>
</body>
<html>
arrmed is offline