All pastes #451161 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-21 09:10 UTC
rendered paste body
<?php

	require_once ('XML/Unserializer.php');

	$dim = $_GET['dim'];
	$char = $_GET['char'];

	// URL of our web service
	$url = "http://www.anarchy-online.com/character/bio/d/".$dim."/name/".$char."/bio.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();

	$name = $data['name'];
	$stats = $data['basic_stats'];
	$org = $data['organization_membership'];
	
	echo '<title>Character Profile of '.$char.'</title>';
    # Picture & title
	echo '<table><tr><th><font size="2">'.$name['nick'].'</font></th><th><font size="2">Character Info</font></th></tr>';
	echo '<tr><td rowspan=4><img src="'.$data['pictureurl'].'"/></td>';
    # Char names
	echo '<td><font size="2">';
	if ($name['firstname'] != "") echo $name['firstname'].' "';
	echo $name['nick'];
	if ($name['lastname'] != "") echo '" '.$name['lastname'];
	echo '</font>';
    
    # Char details
	echo '<tr><td><font size="2">';
	echo '<ul><li>Level: <b>'.$stats['level'].'</b></li>';
	echo '<li>Breed: <b>'.$stats['breed'].'</b></li>';
	echo '<li>Gender: <b>'.$stats['gender'].'</b></li>';
    if ($stats['faction']=="Clan") {
    echo '<li>Faction: <font color="blue"><b>Clan</b></font></li>';
     }else if ($stats['faction']=="Omni") {
    echo '<li>Faction: <font color="red"><b>Omni</b></font></li>';
     }else if ($stats['faction']=="Neutral") {
    echo '<li>Faction: <font color="#CC9966"><b>Neutral</b></font></li>';
    }
	echo '<li>Profession: <b>'.$stats['profession'].' ('.$stats['profession_title'].')</b></li>';
	echo '</td></tr></font>';
    # Link to org, Needs fixing
	echo '<tr><td><font size="2">';
	echo $org['rank'].' of <a href="members_table.php?dim='.$dim.'&org_id='.$org['organization_id'].'">'
		.$org['organization_name'].'</a>';
	echo '</td></tr></font>';
    # AI Level
	echo '<tr><td><font size="2">';
	echo 'Defender Rank: <b>'.$stats['defender_rank'].' ('.$stats['defender_rank_id'].')</b>';
	echo '</td></tr></font>';

	echo '</table>';
	# Back button
	echo '<a href="javascript: history.go(-1)">Back</a>';
	echo '<br>';
	echo '<br>';
	# The link to profile generator
	echo 'Link to Profile: <form><input type="text" size="60" name="profile" value="http://teamflux.org/aotools/lookup.php?dim='.$dim.'&char='.$char.' " READONLY></form>';
	# The link to picture url
	echo 'Link to Picture: <form><input type="text" size="55" name="picture" value="'.$data['pictureurl'].' " READONLY></form>';
	
	echo '<tr>';
    echo '<fieldset><legend>Levelling Graph of '.ucfirst($char).'</legend>';
    echo '<br>';
    echo '<br>';
    echo '<img src="http://auno.org/ao/chargraph.php?name='.$char.'&dimension='.$dim.'&color=000000&width=490&height=160" alt="Levelling graph for '.$char.' "/>';
    echo '</td></fieldset>'; 
	echo '</tr>';
	
	# Finds out which dimension the reader is viewing and then changes links accordingly
	echo ucfirst($char).' on other dimensions:';
	echo '<br>';
	if ($dim=="1") {
    $handle = fopen('http://teamflux.org/aotools/member.php?char='.$char.'&dim='.$dim.'', 'r'); 
    while(!feof($handle)) $dump .= fgets($handle, 1024); 
      if (preg_match("/XML_Parser: Undeclared entity error at XML input line 9:7/is", $dump)) {  
      echo '<strike>Rimor (RK2)</strike>';
      } 
      else {
	echo '<a href="lookup.php?dim=2&char='.$char.' ">Rimor (RK2)</a>';
	}
	echo '<br>';
	echo '<a href="lookup.php?dim=3&char='.$char.' ">Die Neue Welt (German Server)</a>';
	}
	elseif ($dim=="2") {
    echo '<a href="lookup.php?dim=1&char='.$char.' ">Atlantean (RK1)</a>';
	echo '<br>';
	echo '<a href="lookup.php?dim=3&char='.$char.' ">Die Neue Welt (German Server)</a>';
	}
	elseif ($dim=="3") {
	echo '<a href="lookup.php?dim=1&char='.$char.' ">Atlantean (RK1)</a>';
	echo '<br>';
	echo '<a href="lookup.php?dim=2&char='.$char.' ">Rimor (RK2)</a>';
	}
	

	
?>