Jump to content

Php bug help for fopen_wrappers


muhaa

Recommended Posts

Hi guys a friend created a script for us to use on our web site all it does is parse xml file and show up on our php page the problem is our hosting is still using php 4.4.2 and there is a bug in this version on win 2003 iss 6 i was wondering if there is some work around for this bug so i can get this script to work for our site as it is a clan web site for americas army i will enclose my script so you can see what is wrong i think it is in line 42 fopen_wrappers (used with file_get_contents) any help would be much apriciated.. ;D

[code]<?php

//////////////////////////////////////////////////////////////////////////////////////
//Enter your clan info Here
$clanid="9901";
$clanmembers="17";/////////////////////////////////////////////////////////////////////
$clanName="The {A TEAM}";/////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

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
//MEMBERS
$clanmembers=17;
//HONOR
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clanhonor=$stack[0][children][1][children][0][cdata];
}
//Score
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clanscore=$stack[0][children][1][children][1][cdata];
}
//kills
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clankills=$stack[0][children][1][children][2][cdata];
}
//deaths
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clandeaths=$stack[0][children][1][children][3][cdata];
}
//kills to deaths
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clankd=$stack[0][children][1][children][4][cdata];
}
//roe
for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) {
  $clanroe=$stack[0][children][1][children][5][cdata];
}



echo "<body bgcolor='#616042'>";
echo "<center><table width='100%' border='1' cellpadding='0'><tr><td><table width='100%' border = '0' cellpadding= '0' bgcolor='#616042'><td bgcolor= '#999966' font size=\"2\" color=\"#000000\"><center><b>$clanName Clan Stats</b></center></font></td></table>";
echo "<table width='100%' border = '0' cellpadding= '4' cellspacing= '1' bgcolor='#616042'><tr><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Members:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Honor:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Score:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Kills:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Deaths:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>Fragrate:</b></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><b>ROE:</b></font></td></tr>";


echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clanmembers</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clanhonor</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clanscore</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clankills</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clandeaths</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clankd</font></td>";
echo "<td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$clanroe</font></td>";
echo "</table></center>";
echo "</body>";


// 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;
  }
}

$playermap="coming soon";
$playerserver="coming soon";
echo "<center><table width='100%' border = '0' cellpadding= '3' cellspacing= '1' bgcolor='#616042'><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Status:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Member:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Honor:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Kills:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Score:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Map:</b></center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center><b>Server:</b></center></font></td>";

foreach($playerstats as $key => $value) {
$playername=$playerstats[$key][PLAYERNAME];
$playerhonor=$playerstats[$key][PLAYERHONOR];
$playerurl=$playerstats[$key][PLAYERSTATSURL];
$playerscore=$playerstats[$key][PLAYERSCORE];
$playerkills=$playerstats[$key][PLAYERKILLS];
if($playerstats[$key][PLAYERSTATUS]=="1") $statuspic="ponline.gif";
else $statuspic="poffline.gif";

echo "<tr><td bgcolor= '#999966'><center><img border=\"0\" src=\"./images/$statuspic\" width=\"12\" height=\"12\"></center></td><td bgcolor= '#999966'><a target=\"_blank\" href=\"$playerurl\"><font size=\"2\" color=\"#000000\">$playername</font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center>$playerhonor</center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center>$playerkills</center></font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\"><center>$playerscore</center></font></td></a></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$playermap</font></td><td bgcolor= '#999966'><font size=\"2\" color=\"#000000\">$playerserver</font></td></tr>";
}
echo "</table></td></tr></table></center>";
?>
<html>
<body>
<table width="800" border="0" align="center"><tr><td align="center" colspan="9" style="font-size:9px">Layout by: <a class="web" href="http://www.ateamclan.com"></a><a class="web" href="mailto:[email protected]">Hannibal</a> |<a class="web" href="ateamclan.com">The {A TEAM}</a></td></tr></table>
</body>
</html>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34731-php-bug-help-for-fopen_wrappers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.