<?
/*
//||||||||||||||||||||||||||||||||||||||||||||||||\\
\\*          SUPER HERO MOD WEB STATS 3.0         //
//                                                \\
\\  Written By ShadowLeader aka 123 (Tim Hansen)  //
//                                                \\
\\              http://SH-MOD.TK                  //
//          Email: shadowleader@jubii.dk          \\
\\          MSN: shadowleader11@hotmail.com       //
//                                                \\
\\   You are allowed to edit anything in these    //
//     files, as long as these lines remain.      \\
\\                                                //
//   If you have any trouble with the system,     \\
\\       go to www.SH-MOD.TK to get help.         //
//                                                \\
\\   Thanks to:                                   //
//   AlleyKat - Help with Template system         \\
\\   MajesticM00se - A little code                //
//   Vittu - Finding bugs                         \\
\\||||||||||||||||||||||||||||||||||||||||||||||||//
*/

require "include/header.php";

dbconn(true);

stdhead();
/////////START/////////
?>
<?
	$id = $_GET['id'];
	$namemode = $_GET['namemode'];
	$gname = $_GET['name'];
	if($namemode == "1"){
		$main = mysql_query("SELECT SH_KEY, PLAYER_NAME, LAST_PLAY_DATE, XP, SKILL_COUNT FROM sh_savexp WHERE PLAYER_NAME = '$gname' ");
	if(mysql_num_rows($main) != "1") die ("The player name was not found in our database");
	$main2 = mysql_query("SELECT SH_KEY FROM sh_savexp WHERE PLAYER_NAME = '$gname' ");
	while($row1 = mysql_fetch_array($main2)) 
	{
	$newid = $row1["SH_KEY"];
	}
	$level = mysql_query("SELECT SH_KEY , SKILL_NUMBER , HERO_NAME FROM sh_saveskills WHERE SH_KEY = '$newid' ORDER BY SKILL_NUMBER ASC LIMIT 0, 30");

	}else{
	
	$main = mysql_query("SELECT SH_KEY, PLAYER_NAME, LAST_PLAY_DATE, XP, SKILL_COUNT FROM sh_savexp WHERE SH_KEY = '$id' ");
	if(mysql_num_rows($main) != "1") die ("The steamID was not found in our database");

	$level = mysql_query("SELECT SH_KEY , SKILL_NUMBER , HERO_NAME FROM sh_saveskills WHERE SH_KEY = '$id' ORDER BY SKILL_NUMBER ASC LIMIT 0, 30");
	}
	$num_level = mysql_num_rows($level);
	echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">
	<tr>
    <td width=\"30%\"><b>Player</b></td>
    <td width=\"15%\"><b>User Level</b></td>
	<td width=\"25%\"><b>XP</b> ($maxxp max)</td>
	<td width=\"28%\"><b>Last play date</b></td>
	</tr>";

	while($row = mysql_fetch_array($main)) 
	{
	//$lastdate = print_date_time($row["LAST_PLAY_DATE"]);//sql_timestamp_to_unix_timestamp($row["LAST_PLAY_DATE"]);
	$connected = $row["LAST_PLAY_DATE"];
	$lastdate =  "Date ".substr($connected, 0, 4)."/".substr($connected, 4, 2)."/".substr($connected, 6, 2)." - ".substr($connected, 8, 2).":".substr($connected, 10, 2).":".substr($connected, 12, 2);
	echo"<tr>
    <td>$row[PLAYER_NAME]</td>
    <td>$row[SKILL_COUNT]</td>
	<td>$row[XP]</td>
	<td>$lastdate</td>
	</tr></table>";
	}

	echo"<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">
	<tr>
    <td colspan=\"2\" width=\"5%\"><b>Skill</b></td>
    <td colspan=\"2\" width=\"95%\"><b>Hero</b></td>
	</tr>";

	if($num_level == "0" OR $num_level == ""){
	echo"<tr><td colspan=\"3\" width=\"5%\">No heroes found!</td></tr>";
	}else{
	while($row2 = mysql_fetch_array($level)) 
	{
	echo"<tr>
    <td colspan=\"2\" width=\"5%\">$row2[SKILL_NUMBER]</td>
    <td colspan=\"2\" width=\"95%\"><A href=\"sh_hero.php?hero=$row2[HERO_NAME]\">$row2[HERO_NAME]</a></td>
	</tr>";
	}}

	echo "</table>";
?>
<?
/////////END/////////
stdfoot();
?>