Anarchy Online Bulletin Board  

Go Back   Anarchy Online Bulletin Board > Community forums > Knowledge Database

Reply
 
Thread Tools
Old Nov 5th, 2009, 04:06:24   #1
Windguaerd
AO Universe Founder
 
Windguaerd's Avatar
 
Join Date: Nov 2001
How to display an org statistics on a webpage?

Ok, so I used an old code I had saved from years ago which displays my orgs roster (you can check it out here) using PHP and an XML parser.

Here is the php code,

Code:
<?php

	require_once ('XML/Unserializer.php');

	// URL of our web service
	$url = "http://people.anarchy-online.com/org/stats/d/1/name/10749959/basicstats.xml";

	// Initialize cURL
	$ch = curl_init();

	// Set cURL options
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

	// Execute cURL
	$content = curl_exec($ch);

	curl_close($ch);


	// Create instance of XML_Unserializer
	$Unserializer = &new XML_Unserializer();

	$status = $Unserializer->unserialize($content);

	if (PEAR::isError($status))
	{
		die($status->getMessage());
	}

	$data = $Unserializer->getUnserializedData();

	echo '<table id="member_table" width="100%">';
	echo '<tr class="head"><th>Rank</th><th>Name</th><th>Level</th><th>Profession</th></tr>';

	$bgcolor = 1;
	$rank_name = "";

	foreach($data['members']['member'] as $member) {

		if ($rank_name != $member['rank_name']){
			$rank_name = $member['rank_name'];

			if ($bgcolor == 1) {
				$bgcolor = 2;
			} else { $bgcolor = 1; }
		}

		echo '<tr class="bgcolor'.$bgcolor.'">';
		echo '<td>'.$member['rank_name'].'</td>';

		echo '<td>';
		if ($member['firstname'] != "") echo $member['firstname'].' "';
		echo $member['nickname'];
		if ($member['lastname'] != "") echo '" '.$member['lastname'];
		echo '</td>';

		echo '<td>'.$member['level'].'</td>';
		echo '<td>'.$member['profession'].'</td>';
		echo '</tr>';
	}

	echo '</table>';

?>
The question is, how can I change/adapt the code so that my clan's statistics are displayed?

I'm no PHP or XML expert, actually had I not found the old code from a previous clan site, I probably would be asking for the whole process =P

Any help would be appreciated.
__________________
Commander Kyle "Windguaerd" Wagner - 220/70/30 Agent. Leader of Mercury Dragons Clan.
Founding member of the Council of Truth Clerical Staff.

Founder of AO Universe - By Players, For Players! The #1 AO fansite in the whole Galaxy!
Creator/Author of some AO Comics, "Unicorn's Shadows" & "Sworn to Secrecy" mini-series and some AOU guides.

Rubi-Ka Times - The Most Up To Date Rubi-Ka News Portal!
Windguaerd is offline   Reply With Quote
Old Nov 5th, 2009, 05:38:18   #2
Xyphos
iplɹoM 'ollǝH
 
Xyphos's Avatar
 
Join Date: Dec 2006
While it's not against any rules for this kind of thing, usually people goto http://aodevs.com for 3rd party programming.

while http://pastebin.com is a great tool/site for collaborative code instead of using the forums' [ code ] tags.

I'll attempt to help you here, but you'll probably get better responses from aodevs using pastebin.

meanwhile, try using this: http://pastebin.com/d1ad9c695

and here's a live demo of the code: http://xyphos.com/mercurydragons.php
__________________
"When life knocks you on your butt, you have to get back up and punch it in the face." --DJ Ashval of GSP

Nullified "Bitbucket" Deadcode - 220/25 Neut NM Engi @ RK1

AO Items Database and Forums

{edited by Anarrina: see me after school}

Last edited by Xyphos; Nov 5th, 2009 at 05:46:20..
Xyphos is offline   Reply With Quote
Old Nov 5th, 2009, 09:20:33   #3
Windguaerd
AO Universe Founder
 
Windguaerd's Avatar
 
Join Date: Nov 2001
Sorry, I should have been more clear. When I said statistics, I means the windows displaying the numbers of each profession/breed/gender and the percentage overall of each, number of members, etc. The code you provided does the same as the one I already have (except for the background color scheme).

aodevs is mostly for bot and bot coders, since extracting info from AO's xml file is technically not bot related I didn't think I'd get results, also I did a search and nobody has ever ask that question there, ever.

I will try pastebin.
__________________
Commander Kyle "Windguaerd" Wagner - 220/70/30 Agent. Leader of Mercury Dragons Clan.
Founding member of the Council of Truth Clerical Staff.

Founder of AO Universe - By Players, For Players! The #1 AO fansite in the whole Galaxy!
Creator/Author of some AO Comics, "Unicorn's Shadows" & "Sworn to Secrecy" mini-series and some AOU guides.

Rubi-Ka Times - The Most Up To Date Rubi-Ka News Portal!
Windguaerd is offline   Reply With Quote
Old Nov 5th, 2009, 19:42:44   #4
Xyphos
iplɹoM 'ollǝH
 
Xyphos's Avatar
 
Join Date: Dec 2006
Ok, fair enough. how about this then? I added the overall statistics to the bottom of the existing code/page.

working demo: http://xyphos.com/mercurydragons.php
PHP source: http://pastebin.com/m60e29df7


I'm sure you're savvy enough to change the CSS colors around to your liking.



PS. aodevs isn't just for bots but w/e.
__________________
"When life knocks you on your butt, you have to get back up and punch it in the face." --DJ Ashval of GSP

Nullified "Bitbucket" Deadcode - 220/25 Neut NM Engi @ RK1

AO Items Database and Forums

{edited by Anarrina: see me after school}

Last edited by Xyphos; Nov 5th, 2009 at 19:48:51..
Xyphos is offline   Reply With Quote
Old Apr 17th, 2010, 20:46:29   #5
Windguaerd
AO Universe Founder
 
Windguaerd's Avatar
 
Join Date: Nov 2001
Forgotten about this, pastebin expired! grr!
__________________
Commander Kyle "Windguaerd" Wagner - 220/70/30 Agent. Leader of Mercury Dragons Clan.
Founding member of the Council of Truth Clerical Staff.

Founder of AO Universe - By Players, For Players! The #1 AO fansite in the whole Galaxy!
Creator/Author of some AO Comics, "Unicorn's Shadows" & "Sworn to Secrecy" mini-series and some AOU guides.

Rubi-Ka Times - The Most Up To Date Rubi-Ka News Portal!
Windguaerd is offline   Reply With Quote
Old Apr 26th, 2010, 08:39:10   #6
Windguaerd
AO Universe Founder
 
Windguaerd's Avatar
 
Join Date: Nov 2001
Quote:
Originally Posted by Xyphos View Post
Ok, fair enough. how about this then? I added the overall statistics to the bottom of the existing code/page.

working demo: http://xyphos.com/mercurydragons.php
PHP source: http://pastebin.com/m60e29df7


I'm sure you're savvy enough to change the CSS colors around to your liking.



PS. aodevs isn't just for bots but w/e.
Can you hook me up with another pastebin please?
__________________
Commander Kyle "Windguaerd" Wagner - 220/70/30 Agent. Leader of Mercury Dragons Clan.
Founding member of the Council of Truth Clerical Staff.

Founder of AO Universe - By Players, For Players! The #1 AO fansite in the whole Galaxy!
Creator/Author of some AO Comics, "Unicorn's Shadows" & "Sworn to Secrecy" mini-series and some AOU guides.

Rubi-Ka Times - The Most Up To Date Rubi-Ka News Portal!
Windguaerd is offline   Reply With Quote
Old Apr 29th, 2010, 10:12:01   #7
Xyphos
iplɹoM 'ollǝH
 
Xyphos's Avatar
 
Join Date: Dec 2006
aw, man... I don't have the code anymore, and I'll have to translate a new version.
__________________
"When life knocks you on your butt, you have to get back up and punch it in the face." --DJ Ashval of GSP

Nullified "Bitbucket" Deadcode - 220/25 Neut NM Engi @ RK1

AO Items Database and Forums

{edited by Anarrina: see me after school}
Xyphos is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:13:17.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © Funcom 1999 - 2006