TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,055
  • Total Topics: 21,337
  • Online today: 201
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 136
  • Total: 136

Very strange behaviour

Started by mebymyself, October 13, 2006, 05:14:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mebymyself

sure, here it is:


<?php

//Note I did not create the XML portion of this script nor
//do I know who did as someone sent it to me.
//If you know who origionally made this, let me know and I will give them credit.

//
// Enter the clan id here and the style of the status button that you want
//
$clanid = "49965";
$style = "1";
//
// End enter stuff
//

function startTag($parser, $name, $attrs) {
global
$stack;

$tag=array("name"=>$name,"attrs"=>$attrs);
array_push($stack,$tag);
}

function
cdata($parser, $cdata) {
global
$stack;

$stack[count($stack)-1]['cdata'] .= $cdata;  
}

function
endTag($parser, $name) {
global
$stack;

$stack[count($stack)-2]['children'][] = $stack[count($stack)-1];
array_pop($stack);
}


// Parse XML

$stack = array();
$claninfo = array();
$clanstats = array();
$playerstats = array();

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "cdata");

$xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid";
$data = xml_parse($xml_parser,file_get_contents($xmllink));
if(!
$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));

xml_parser_free($xml_parser);


// Get Data

// Get Clan Profile Data
for($i = 0; $i < sizeof($stack[0][children][0][children]); $i++) {
 
$valname=$stack[0][children][0][children][$i][name];
 
$claninfo[$valname]=$stack[0][children][0][children][$i][cdata];
}

// Get Clan Stats Data
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
 
$valname=$stack[0][children][1][children][$i][name];
 
$clanstats[$valname]=$stack[0][children][1][children][$i][cdata];
}

// Get Player Data
for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) {
 for(
$x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) {
 
$valname=$stack[0][children][2][children][$i][children][$x][name];
 
$value=$stack[0][children][2][children][$i][children][$x][cdata];
  if(
$valname=="PLAYERID") $pid=$value;
 
$playerstats[$pid][$valname]=$value;
 }
}

// Header and start of table code
echo '<table border="1"><th>Player Status</th><th>Player Name</th><th>Player Honor</th><th>Player Kills</th><th>Player Deaths</th><th>Player FR</th>';

foreach(
$playerstats as $key => $value) {
$playerid = $playerstats[$key][PLAYERID];
$playername = $playerstats[$key][PLAYERNAME];
$playerhonor = $playerstats[$key][PLAYERHONOR];
$playerurl = $playerstats[$key][PLAYERSTATSURL];
$playerkills = $playerstats[$key][PLAYERKILLS];
$playerdeaths = $playerstats[$key][PLAYERDEATHS];

$playerfr = round(($playerkills / $playerdeaths), 2);

//Display Code
echo '<tr><td><img src="http://aaotracker.com/trackericon.php?userid=' . $playerid . '&style=' . $style . '"></td><td><a target="_blank" href="' . $playerurl . '">' . $playername . '</a></td><td>' .$playerhonor . '</td><td>' . $playerkills . '</td><td>' . $playerdeaths . '</td><td>' . $playerfr . '</tr>';
}

//End of table code
echo '</table>';

?>


akulion

thats really weird

even as a stand alone article with all the code it is still only showing the headers

u may have to wait a bit on this one thurnok may be able to help u with ths one - hes a pure php guru and runs his own gaming clan too

just wait till hes online :up:

mebymyself

Hmm...
As stand alone I couldnt make it work at all. that why i used "include"

Anyway thank you for your support

akulion

ur welcome :up:

ive asked thurnok to have a look -once he gets home and if hes able to figure it out - he will respond :)

Thurnok

I'm at work right now, but I'll take a look when I get home tonight  :)
Thurnok
The one, the only!

mebymyself

Hi Thurnok!

I am waiting eagerly for solution. Somehow I feel that you will have it :)

BTW I tried your AA server block but my provider doesn't support fsockopen() :(

This website is proudly hosted on Crocweb Cloud Website Hosting.