<html>
<head>
<title>Visitenkarten</title>
<link rel="shortcut icon" href="/favicon.ico">
</head>
<body text="#333333">
<div style="font-family:verdana;font-size:12px;">
<?php
function show($chars, $chaos) {
$pattern = '°^(.*)/multimedia/images/chars/ingame/(.*)_(m|f).gif(.*)<span style="font-face: \'Trebuchet MS\', \'Lucida Grande\', Arial;font-size: 1.4em; font-weight: bold;">(.*)</span> <p /> <span style="font-face: \'Trebuchet MS\', \'Lucida Grande\', Arial;font-weight: bold;">(.*)</span> <br /> <span style="font-face: \'Trebuchet MS\', \'Lucida Grande\', Arial;">(.*)</span> <br /> <span style="font-face: \'Trebuchet MS\', \'Lucida Grande\', Arial;"> Level: ([0-9]{1,2}/[0-9]{1,2})(.*)$°msi';
$ret = '';
$ret .= '<table border="1" cellspacing="0" cellpadding="5">'."\n";
$ret .= ' <tr><th>Name</th><th>Class</th><th>Level</th><th>Guild</th></tr>'."\n";
foreach ($chars as $c) {
if ($chaos === false) $url = "http://www.euro-ro.net/vc/?c=".urlencode($c)."&w=1&b=05";
else $url = "http://www.euro-ro.net/vc/?c=".urlencode($c)."&w=1&b=05";
$handle = fopen ($url, "r");
/*DEBUG*/echo '<pre>';
/*DEBUG*/var_dump($handle);
/*DEBUG*/var_dump($text);
/*DEBUG*/echo '</pre>';
$text = fread ($handle, 10000);
fclose ($handle);
preg_match($pattern, trim($text), $x);
$r['name'] = trim(htmlentities($x[5]));
$r['class'] = trim(htmlentities($x[2]));
$r['sex'] = trim(htmlentities($x[3]));
$r['guild'] = trim(htmlentities($x[6]));
$r['title'] = trim(htmlentities($x[7]));
$r['level'] = trim(htmlentities($x[8]));
/*DEBUG*/echo '<pre>';
/*DEBUG*/var_dump($x);
/*DEBUG*/echo '</pre>';
/*DEBUG*/echo '<pre>';
/*DEBUG*/var_dump($r);
/*DEBUG*/echo '</pre>';
$ret .= ' <tr><td style="color:';
if ('m' == $r['sex'])
$ret .= '#6699FF;">';
else
$ret .= '#FF99FF;">';
$ret .= $r['name'].'</td><td>'.$r['class'].'</td><td style="color:';
if (false === strstr($r['level'],'99/'))
$ret .= '#000000;">';
else
$ret .= '#990000;font-weight:bold;">';
$ret .= $r['level'].'</td><td>';
if (strlen($r['guild']) > 0)
$ret .= $r['guild'].' ['.$r['title'].']';
else
$ret .= ' ';
$ret .= '</td></tr>'."\n";
}
$ret .= '</table>'."\n";
return $ret;
}
$chars = array('Holy Langer','Magic Langer','Langer');
echo show($chars, true);
?>
</div>
</body>
</html>