Code PHP :
<?php // 3dchar_viewer.php
$config['ip'] = "xxx.xxx.xxx.xxx";
$config['user'] = "user";
$config['pass'] = "pass";
$config['char_db'] = "character";
$config['world_db'] = "world";
$dbc = mysql_connect($config['ip'], $config['user'], $config['pass']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>3D Character Viewer</title>
</head>
<body>
<form action="" method="post">
<table align="center" border="0">
<tr>
<td class="td">
<label for="name">
Character name:</label></td>
<td>
<input type="text" class="select" id="name" maxlength="50" name="name" /><br></td>
</tr>
</table><center><br />
<input type="submit" name="action" value="Search" class="button" />
</form></center>
<?php
if (isset($_POST['action'])) {
$charname = $_POST["name"];
$definebag = "0";
$errors = 0;
mysql_select_db($config['char_db']);
$query = "SELECT item FROM character_inventory WHERE guid = '$guid' AND slot < '18'";
$result=mysql_query($query);
if (!mysql_num_rows($result) == 0) { // If OK
$row = mysql_fetch_array($result);
$guid = $row['guid'];
$race = $row['race'];
$gender = $row['gender'];
$b = $row['playerBytes'];
$b2 = $row['playerBytes2'];
// Set Character Features
$ha = ($b>>16)%256;
$hc = ($b>>24)%256;
$fa = ($b>>8)%256;
$sk = $b%256;
$fh = $b2%256;
// Set Character Race/Gender
$char_race = array(
1 => 'human',
2 => 'orc',
3 => 'dwarf',
4 => 'nightelf',
5 => 'scourge',
6 => 'tauren',
7 => 'gnome',
8 => 'troll',
10 => 'bloodelf',
11 => 'draenei');
$char_gender = array(
0 => 'male',
1 => 'female');
$rg = $char_race[$race].$char_gender[$gender];
// Set Character Equipment String
mysql_select_db($config['char_db']);
$query = "SELECT entry FROM playeritems WHERE ownerguid = '$guid' AND slot < '18'";
$result=mysql_query($query);
if (!mysql_num_rows($result) == 0) { // If OK
$eq = "";
while ($row=mysql_fetch_array($result)) {
$entry = $row['entry'];
if ($entry != "") {
mysql_select_db($config['world_db']);
$query2 = "SELECT displayid, inventorytype FROM Items WHERE entry = '$entry'";
$result2 = mysql_query($query2);
if (!mysql_num_rows($result2) == 0) {
$row2 = mysql_fetch_array($result2);
$displayid = $row2['displayid'];
$inventory_type = $row2['inventorytype'];
if ($eq == "") {
$eq = $inventory_type.','.$displayid;
} else {
$eq .= ','.$inventory_type.','.$displayid;
}
} else { // If not OK
echo '<p>The DisplayID could not be retrieved. We apologize for any inconvenience.</p>'; // Public message.
//echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.
$errors++;
}
}
}
} else { // If not OK
echo '<p>The Inventory could not be retrieved. We apologize for any inconvenience.</p>'; // Public message.
//echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.
$errors++;
}
} else { // If not OK
echo '<p>The Character could not be retrieved. We apologize for any inconvenience.</p>'; // Public message.
//echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.
$errors++;
}
if ($errors == 0) {
?>
<div id="model_scene" align="center">
<object id="wowhead" type="application/x-shockwave-flash" data="http://static.wowhead.com/modelviewer/ModelView.swf" height="400px" width="300px">
<param name="quality" value="high">
<param name="allowscriptaccess" value="always">
<param name="menu" value="false">
<param value="transparent" name="wmode">
<param name="flashvars" value="model=<?php echo $rg ?>&modelType=16&ha=<?php echo $ha;?>&hc=<?php echo $hc;?>&fa=<?php echo $fa;?>&sk=<?php echo $sk;?>&fh=<?php echo $fh;?>&fc=0&contentPath=http://static.wowhead.com/modelviewer/&blur=0&equipList=<?php echo $eq ?>">
<param name="movie" value="http://static.wowhead.com/modelviewer/ModelView.swf">
</object>
</div>
<?php
}
} // End of Submit Conditional
?>
</body>
</html>
<?php
mysql_close($dbc);
?>