<?php

/*
////////////////////////////////////////////////////////////////////////////
//                                                                        //
//               FSTracker - ForceSoBe BitTorrent Tracker                 //
//                                                                        //
////////////////////////////////////////////////////////////////////////////
//                                                                        //
// This File is part of FSTracker. FSTracker is based on BTSource,        //
// originally by RedBeard of TorrentBits, extensively modified by         //
// Force and SoBe                                                         //
//                                                                        //
////////////////////////////////////////////////////////////////////////////
//                                                                        //
// Obige Zeilen dürfen nicht enfernt werden!   Do not remove above lines! //
//                                                                        //
////////////////////////////////////////////////////////////////////////////
 */

require "include/bittorrent.php";

dbconn(false);

loggedinorreturn();

function bark($msg)
{
    stdhead();
    stdmsg("Error", $msg);
    stdfoot();
    exit;
} 

function get_domain($ip)
{
    $dom = @gethostbyaddr($ip);
    if ($dom == $ip || @gethostbyname($dom) != $ip)
        return "<a href=\"whois.php?ip=$ip\" target=\"nvwhois\">$ip</a>";
    else {
        $dom = strtoupper($dom);
        return "<a href=\"whois.php?ip=$ip\" target=\"nvwhois\">$ip</a> ($dom)";
    } 
} 

function maketable($res)
{
    $ret = "<table class=tableinborder border=0 cellspacing=1 cellpadding=4 width=\"100%\">" . "<tr><td class=tablecat align=center>Typ</td><td class=tablecat width=\"100%\">Name</td><td class=tablecat align=center>TTL</td><td class=tablecat align=center>Gr&ouml;sse</td><td class=tablecat align=right>Se.</td><td class=tablecat align=right>Le.</td><td class=tablecat align=center>Hochgel.</td>\n" . "<td class=tablecat align=center>Runtergel.</td><td class=tablecat align=center>Ratio</td></tr>\n";
    while ($arr = mysql_fetch_assoc($res)) {
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            $ratio = "<span class=" . get_ratio_color($ratio) . ">$ratio</span>";
        } else
        if ($arr["uploaded"] > 0)
            $ratio = "Inf.";
        else
            $ratio = "---";
        $catimage = htmlspecialchars($arr["image"]);
        $catname = htmlspecialchars($arr["catname"]);
        $ttl = (28 * 24) - floor((time() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600);
        if ($ttl == 1) $ttl .= "<br>hour";
        else $ttl .= "<br>hours";
        $size = str_replace(" ", "<br>", mksize($arr["size"]));
        $uploaded = str_replace(" ", "<br>", mksize($arr["uploaded"]));
        $downloaded = str_replace(" ", "<br>", mksize($arr["downloaded"]));
        $seeders = number_format($arr["seeders"]);
        $leechers = number_format($arr["leechers"]);
        $ret .= "<tr><td class=tableb style='padding: 0px'><img src=\"" . $GLOBALS["PIC_BASE_URL"] . $catimage . "\" alt=\"$catname\" title=\"$catname\" width=42 height=42></td>\n" . "<td class=tablea><a href=details.php?id=$arr[torrent]&amp;hit=1><b>" . htmlspecialchars($arr["torrentname"]) . "</b></a></td><td class=tableb align=center>$ttl</td><td class=tablea align=center>$size</td><td class=tableb align=right>$seeders</td><td class=tablea align=right>$leechers</td><td class=tableb align=center>$uploaded</td>\n" . "<td class=tablea align=center>$downloaded</td><td class=tableb align=center>$ratio</td></tr>\n";
    
} 
    $ret .= "</table>\n";
    return $ret;
} 
// BEGIN: Groups Edition by truenoir | Edited by PGoku
function makegroups($res)
{
$ret = "";
while ($arr = mysql_fetch_assoc($res)) {
$grpName=$arr["name"];
$ret .= "<tr><td class='tableb'><center><b>$grpName</b><br>".($arr["banner"]?"<img src=\"$arr[banner]\" alt=\"$catname\" title=\"$catname\" border=0>":"")."</center></td></tr>\n";
} 
$ret .= "\n";
return $ret;
} 
// END: Groups Edition by truenoir | Edited by PGoku

function makecomptable($res)
{
    $ret = "<table class=tableinborder border=0 cellspacing=1 cellpadding=4 width=\"100%\">" . "<tr><td class=tablecat style=\"text-align:center\">Typ</td><td class=tablecat width=\"100%\">Name</td>\n" . "<td class=tablecat style=\"text-align:center\">Fertiggestellt</td><td class=tablecat>Se.</td><td class=tablecat>Le.</td><td class=tablecat>Hochgel.</td><td class=tablecat>Runtergel.</td></tr>\n";
    while ($arr = mysql_fetch_assoc($res)) {
        $catimage = htmlspecialchars($arr["image"]);
        $catname = htmlspecialchars($arr["catname"]);
        $ret .= "<tr><td class=\"tableb\" style=\"padding: 0px\"><img src=\"" . $GLOBALS["PIC_BASE_URL"] . $catimage . "\" alt=\"$catname\" title=\"$catname\" width=42 height=42></td>\n<td class=tablea>";
        if ($arr["torrent_origid"] > 0) {
            $seeders = number_format($arr["seeders"]);
            $leechers = number_format($arr["leechers"]);
            $ret .= "<a href=\"details.php?id=$arr[torrent]&amp;hit=1\"><b>" . htmlspecialchars($arr["torrent_name"]) . "</b></a></td>";
            $ret .= "<td class=\"tableb\" style=\"text-align:center\">" . str_replace(" ", "<br />", date("d.m.Y H:i:s", sql_timestamp_to_unix_timestamp($arr["complete_time"]))) . "</td>";
            $ret .= "<td class=\"tablea\" style=\"text-align:right\">$seeders</td>";
            $ret .= "<td class=\"tableb\" style=\"text-align:right\">$leechers</td>";
            $ret .= "<td class=\"tablea\" style=\"text-align:right\" nowrap=\"nowrap\">" . mksize($arr["uploaded"]) . "<br>@ " . mksize($arr["uploaded"] / max(1, $arr["uploadtime"])) . "/s</td>";
            $ret .= "<td class=\"tablea\" style=\"text-align:right\" nowrap=\"nowrap\">" . mksize($arr["downloaded"]) . "<br>@ " . mksize($arr["downloaded"] / max(1, $arr["downloadtime"])) . "/s</td>";
            $ret .= "</tr>\n";
        } else {
            $ret .= "<b>" . htmlspecialchars($arr["torrent_name"]) . "</b>";
            $ret .= "</td><td class=\"tableb\" style=\"text-align:center\">" . str_replace(" ", "<br />", date("d.m.Y H:i:s", sql_timestamp_to_unix_timestamp($arr["complete_time"]))) . "</td>";
            $ret .= "<td class=\"tablea\" style=\"text-align:center\" colspan=\"4\">Gel&ouml;scht</td></tr>\n";
        } 
    } 

    $ret .= "</table>\n";
    return $ret;
} 

$id = intval($_GET["id"]);

if (!is_valid_id($id))
    bark("Bad ID $id.");

$r = @mysql_query("SELECT * FROM users WHERE id=$id") or sqlerr();
$user = mysql_fetch_array($r) or bark("No user with ID $id.");
if ($user["status"] == "pending") die;
$r = mysql_query("SELECT id, name, added, seeders, leechers, category FROM torrents WHERE `activated`='yes' AND owner=$id ORDER BY added DESC") or sqlerr();
if (mysql_num_rows($r) > 0) {
    $torrents = "<table class=tableinborder border=0 cellspacing=1 cellpadding=4 width=\"100%\">\n" . "<tr><td class=tablecat>Typ</td><td class=tablecat width=\"100%\">Name</td><td class=tablecat>Hochgeladen</td><td class=tablecat>Seeder</td><td class=tablecat>Leecher</td></tr>\n";
    while ($a = mysql_fetch_assoc($r)) {
        $r2 = mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE__, __LINE__);
        $a2 = mysql_fetch_assoc($r2);
        $cat = "<img src=\"" . $GLOBALS["PIC_BASE_URL"] . $a2["image"] . "\" alt=\"$a2[name]\" title=\"$a2[name]\">";
        $torrents .= "<tr><td class=tableb style='padding: 0px'>$cat</td><td class=tablea><a href=details.php?id=" . $a["id"] . "&hit=1><b>" . htmlspecialchars($a["name"]) . "</b></a></td>" . "<td class=tableb align=center>" . str_replace(" ", "<br />", date("d.m.Y H:i:s", sql_timestamp_to_unix_timestamp($a["added"]))) . "</td>" . "<td class=tablea align=right>$a[seeders]</td><td class=tableb align=right>$a[leechers]</td></tr>\n";
    } 
    $torrents .= "</table>";
} 

if ($GLOBALS["CLIENT_AUTH"] == CLIENT_AUTH_PASSKEY)
    $announceurl = preg_replace("/\\{KEY\\}/", preg_replace_callback('/./s', "hex_esc", str_pad($user["passkey"], 8)), $GLOBALS["PASSKEY_ANNOUNCE_URL"]);
else
    $announceurl = $GLOBALS["ANNOUNCE_URLS"][0];

$addr = "";
$peer_addr = "";
if ($user["ip"] && (get_user_class() >= UC_MODERATOR || $user["id"] == $CURUSER["id"])) {
    $ip = $user["ip"];
    $addr = get_domain($ip);

    $res = mysql_query("SELECT DISTINCT(ip) AS ip FROM peers WHERE userid=$id");
    if (mysql_num_rows($res)) {
        while ($peer_ip = mysql_fetch_assoc($res)) {
            if ($peer_addr != "")
                $peer_addr .= "<br>";
            $peer_addr .= get_domain($peer_ip["ip"]);
        } 
    } 
} 
if ($user["added"] == "0000-00-00 00:00:00") {
    $joindate = 'N/A';
    $down_per_day = "";
    $upped_per_day = "";
} else {
    $joindate = "$user[added] (Vor " . get_elapsed_time(sql_timestamp_to_unix_timestamp($user["added"])) . ")";
    $days_regged = round((time() - sql_timestamp_to_unix_timestamp($user["added"])) / 86400);
    if ($days_regged) {
        $down_per_day = "(" . mksize(floor($user["downloaded"] / $days_regged)) . " / Tag)";
        $upped_per_day = "(" . mksize(floor($user["uploaded"] / $days_regged)) . " / Tag)";
    } 
} 
$lastseen = $user["last_access"];
if ($lastseen == "0000-00-00 00:00:00")
    $lastseen = "nie";
else {
    $lastseen .= " (Vor " . get_elapsed_time(sql_timestamp_to_unix_timestamp($lastseen)) . ")";
} 
$res = mysql_query("SELECT COUNT(*) FROM comments WHERE user=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$torrentcomments = $arr3[0];
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$forumposts = $arr3[0];
// if ($user['donated'] > 0)
// $don = "<img src=\"".$GLOBALS["PIC_BASE_URL"]."starbig.gif\">";
$res = mysql_query("SELECT name,flagpic FROM countries WHERE id=$user[country] LIMIT 1") or sqlerr();
if (mysql_num_rows($res) == 1) {
    $arr = mysql_fetch_assoc($res);
    $country = "<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "flag/" . $arr["flagpic"] . "\" alt=\"" . $arr["name"] . "\" style=\"margin-left: 8pt;vertical-align: middle;\">";
} 

// if ($user["donor"] == "yes") $donor = "<td class=embedded><img src=\"".$GLOBALS["PIC_BASE_URL"]."starbig.gif\" alt='Donor' style='margin-left: 4pt'></td>";
// if ($user["warned"] == "yes") $warned = "<td class=embedded><img src=\"".$GLOBALS["PIC_BASE_URL"]."warnedbig.gif\" alt='Warned' style='margin-left: 4pt'></td>";
$res = mysql_query("SELECT torrent,added,traffic.uploaded,traffic.downloaded,torrents.name as torrentname,categories.name as catname,size,image,category,seeders,leechers FROM peers JOIN traffic ON peers.userid = traffic.userid AND peers.torrent = traffic.torrentid JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category = categories.id WHERE peers.userid=$id AND seeder='no'") or sqlerr();
$leeching = "";
if (mysql_num_rows($res) > 0)
    $leeching = maketable($res);
$res = mysql_query("SELECT torrent,added,traffic.uploaded,traffic.downloaded,torrents.name as torrentname,categories.name as catname,size,image,category,seeders,leechers FROM peers JOIN traffic ON peers.userid = traffic.userid AND peers.torrent = traffic.torrentid JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category = categories.id WHERE peers.userid=$id AND seeder='yes'") or sqlerr();
$seeding = "";
if (mysql_num_rows($res) > 0)
    $seeding = maketable($res);
$completed = "";
if (get_user_class() >= UC_MODERATOR || (isset($CURUSER) && $CURUSER["id"] == $user["id"])) {
    if (!$_GET["allcompleted"])
        $limit_comp = " LIMIT 3";
    else
        $limit_comp = "";
    $res = mysql_query("SELECT torrent_id as torrent,torrent_name,complete_time,torrents.seeders as seeders,torrents.leechers as leechers,torrents.id as torrent_origid,categories.name as catname,image,traffic.uploaded,traffic.downloaded,traffic.uploadtime,traffic.downloadtime FROM completed LEFT JOIN traffic ON completed.torrent_id = traffic.torrentid AND completed.user_id = traffic.userid LEFT JOIN torrents ON completed.torrent_id = torrents.id LEFT JOIN categories ON completed.torrent_category = categories.id WHERE user_id=$id ORDER BY complete_time DESC$limit_comp");
    if (mysql_num_rows($res) > 0)
        $completed = makecomptable($res);
}

// BEGIN: Groups Edition by truenoir
$grpres=mysql_query("select teams.* from teams,teammembers where teams.id=teammembers.teamid and teammembers.userid=$user[id] order by teams.sort");
if (mysql_num_rows($grpres) > 0)
    $groups = makegroups($grpres);
if($user["id"]!=$CURUSER["id"])
{
  $grpsel="";
  $grpres=mysql_query("select teams.* from teams,teammembers where teams.id=teammembers.teamid and teammembers.userid=$CURUSER[id] and teammembers.leader='yes' order by teams.sort");
  while($grparr=mysql_fetch_assoc($grpres))
  {
    $grp2=mysql_fetch_row(mysql_query("select count(id) from teammembers where teamid=$grparr[id] and userid=$user[id]"));
    if($grp2[0]==0)
      $grpsel.="<option value=\"$grparr[id]\">$grparr[name]-".ucfirst($grparr["typ"])."</option>";
  }
  if($grpsel!="")
    $grpsel="<select name=\"group\"><option value=\"0\">---[ Bitte ausw&auml;hlen ]---</option>$grpsel</select>";
  else
    unset($grpsel);
}
// END: Groups Edition by truenoir
stdhead("Benutzerprofil von " . $user["username"]);
$enabled = $user["enabled"] == 'yes';
$webseed = $user["webseed"] == 'yes';
$shoutpost = $user["shoutpost"] == 'yes';
$vdsl = $user["vdsl"] == 'yes';
$promoter = $user["promoter"] == 'yes';
$adsl = $user["adsl"] == 'yes';
$acceptrules = $user["accept_rules"] == 'no';
$allowupload = $user["allowupload"] == 'yes';
$con = $user["con"] == 'yes';
$beobachtung = $user["beobachtung"];
$beobachtet_von = $user["beobachtet_von"];

$acctdata = mysql_fetch_assoc(mysql_query("SELECT `baduser` FROM `accounts` WHERE `userid`=$id"));
$baduser = $acctdata["baduser"];

begin_frame("<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "personal.png\" width=\"22\" height=\"22\" alt=\"\" style=\"vertical-align: middle;\">  Benutzerprofil von " . $user["username"] . get_user_icons($user, true) . "&nbsp;" . $country, false, "85%");
begin_table(true);
if ($user["enabled"] == "no")
{
    print("<table width=\"100%\" border=0 cellspacing=1 cellpadding=4 class=tablea>");
    print("<tr><td colspan=\"2\" class=\"tablea\"><center><b>Dieser Account wurde gesperrt</b></center></td></tr>\n");
    print("<tr><td class=tablea colspan=2><center><img src=/pic/deactivated.png>\n</center></td></tr>");     
 
//////////////////////////////////////////REPORT////////////////////////////////
   
    print("<tr><td class=tableb>User melden</td><td class=tablea align=left><a href=report.php?typ=user&id=$id><b>Hier</b></a> klicken um den User dem Team zu melden.</td></tr>\n");
    
//////////////////////////////////////////REPORT////////////////////////////////

} else {
?>

<?php

if (!$enabled)
    print("<tr><td colspan=\"2\" class=\"tablea\"><b>Dieser Account wurde gesperrt</b></td></tr>\n");
elseif ($CURUSER["id"] <> $user["id"]) {
    $r = mysql_query("SELECT id FROM friends WHERE userid=$CURUSER[id] AND friendid=$id") or sqlerr(__FILE__, __LINE__);
    $friend = mysql_num_rows($r);
    $r = mysql_query("SELECT id FROM blocks WHERE userid=$CURUSER[id] AND blockid=$id") or sqlerr(__FILE__, __LINE__);
    $block = mysql_num_rows($r);


	if ($user["class"] < UC_MODERATOR || $CURUSER["class"] >= UC_MODERATOR)

    if ($friend)
        print("<tr><td colspan=\"2\" class=\"tablea\" align=\"center\"><a href=friends.php?action=delete&type=friend&targetid=$id>Von Freundesliste entfernen</a></td></tr>\n");
    elseif ($block)
        print("<tr><td colspan=\"2\" class=\"tablea\" align=\"center\"><a href=friends.php?action=delete&type=block&targetid=$id>Von Blockliste entfernen</a></td></tr>\n");
    else {
        print("<tr><td class=\"tablea\" align=\"center\"><a href=friends.php?action=add&type=friend&targetid=$id>Zu Freunden hinzufügen</a></td>");
        print("<td class=\"tablea\" align=\"center\"><a href=friends.php?action=add&type=block&targetid=$id>Zu Blockliste hinzufügen</a></td></tr>\n");
    } 
} 
if ($user["anon"] == 'yes')
{
    //print("<table width=\"100%\" border=1 cellspacing=0 cellpadding=5 class=main>");
    print("<tr><td colspan=2 class=tableb><center>Der User m&ouml;chte nicht, dass man seine Details sehen kann!</center></td></tr>\n");
    if ($user["avatar"])
    print("<tr><td colspan=2 class=tableb><center><img style=\"max-width:350px;\" alt=\"avatar\" src=\"" . htmlspecialchars($user["avatar"]) . "\" /></center></td></tr>\n");
    if ($user["info"])
    print("<tr valign=top><td align=left colspan=2 class=tableb>" . format_comment($user["info"]) . "</td></tr>\n");
        
//////////////////////////////////////////REPORT////////////////////////////////


				if ($CURUSER["id"] != $user["id"]) {
					if (get_user_class() >= UC_GUTEAM) {
						$showpmbutton = true;
						$showemailbutton = true;
					}
					else {
						if ($user["acceptpms"] == "yes") {
							$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
							$showpmbutton = (mysql_num_rows($r) == 1 ? false : true);
						}
						elseif ($user["acceptpms"] == "friends") {
							$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
							$showpmbutton = (mysql_num_rows($r) == 1 ? true : false);
						} 
				
					if ($user["accept_email"] == "yes") {
						$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
						$showemailbutton = (mysql_num_rows($r) == 1 ? false : true);
					}
					elseif ($user["accept_email"] == "friends") {
						$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
						$showemailbutton = (mysql_num_rows($r) == 1 ? true : false);
					} 
					} 
				} 

    print("<tr><td class=tableb>User / Avatar melden</td><td class=tablea align=left><a href=report.php?user=$id><b>Hier</b></a> klicken um den User dem Team zu melden.</td></tr>\n");
if ($showpmbutton)
{
    print("<tr><td class=tableb>PN Schicken</td><td class=tablea align=left><form method=\"get\" action=\"messages.php\" style=\"display:inline\"><input type=\"hidden\" name=\"action\" value=\"send\"><input type=\"hidden\" name=\"receiver\" value=\"". $user["id"]."\"><input type=\"submit\" value=\"Nachricht senden\" style=\"height: 23px\"></form></td></tr>\n");
} 
if ($showemailbutton)
{
    print("<tr><td class=tableb>EMail Senden</td><td class=tablea align=left><form method=\"get\" action=\"email-gateway.php\" style=\"display:inline\"><input type=\"hidden\" name=\"id\" value=\"".$user["id"]."\"><input type=\"submit\" value=\"E-Mail senden\" style=\"height: 23px\"></form></td></tr>\n");
}
  
       //////////////////////////////////////////REPORT////////////////////////////////

    if (get_user_class() < UC_MODERATOR && $user["id"] != $CURUSER["id"])
    {
        //print("</table>");
        end_main_frame();
        stdfoot();
        exit;
    }
  //  print("</table><br>");
  
    
    /*
     * 
     * 
     * all classes below UC-MODERATOR will not see the following details
     * 
     * 
     */
    
    
    
    
    
    
}
    //BEGIN: Account Parken by volcem
		if ($user["parked"] == 'yes')
		
		{
		print("<tr><td class=\"tablea\" align=\"center\">Dieser user hat keine up download rechte>>!</td>");
		print("<td class=\"tablea\" align=\"center\">User ist auf Parken gestellt!</td></tr>");
		}
	//ENDE: Account Parken by volcem


end_table();

?>

<!-- hier beginnt das neue Design der Userdetails-->

<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%">

  	<tr>
    		<td class="tableb" width="50%" align="left" valign="top">
			<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=left>
				<?php
				print("<tr><td class=tabletitle colspan=2><center><b>Profil von ".htmlspecialchars($user["username"])."</b></center></td></tr><tr>");
				?>
				<tr><td class="tableb" width=1%>Registriert</td><td class=tablea align=left width=49%><?=$joindate?></td></tr>
				<tr><td class="tableb">Zuletzt&nbsp;aktiv</td><td class=tablea align=left><?=$lastseen?><?php
/* BEGINN: Onlineaktivitaeten speichern by truenoir */
  if(get_user_class()>=UC_SYSOP)
    echo "&nbsp;<img src=\"$GLOBALS[PIC_BASE_URL]help.png\" alt=\"Aktivit&auml;ten anzeigen\" style=\"border-width:0px;width:12px;height:12px\" onmouseover=\"return overlib('<img src=\'pic_onlinezeit.php?id=".$id."\' alt=\'Aktivit&auml;tsgrafik\' />');\" onmouseout=\"return nd();\"/>\n";
/* ENDE: Onlineaktivitaeten speichern by truenoir */
?></td></tr><!--Start Flush Users by StiFFa / inclusiv takeflush.php-->
			
				<? if (get_user_class() >= UC_MODERATOR)
				 {?>
				<tr><td class="tableb">Flush Torrents</td><td class=tablea align=left width=99%><?print("<h0>Flush Torrents, <a href=takeflush.php?id=$user[id]>$user[username]</a>!</h0>\n");?></td></tr>
				<?php }
				if ($user["avatar"])
					print("<tr><td class=tableb>Avatar</td><td class=tablea align=left><img style=\"max-width:150px;\" alt=\"avatar\" src=\"" . htmlspecialchars($user["avatar"]) . "\" /></td></tr>\n");
print("<tr><td class=tableb>Rang</td><td class=tablea align=left>" . get_user_class_name($user["class"]) . "</td></tr>\n");
				
				if ($user["title"])
					print("<tr><td class=tableb>Titel</td><td class=tablea align=left>" . htmlspecialchars($user["title"]) . "</td></tr>\n");  


				?>

			</table>
    		</td>
    		<td class=tableb width=50% align="right" valign="top">
			<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=right>
		
				<?php
				//-------------Real Uplod-Download Speed by StiFFa Start---------------------
				
				$speedu = mysql_query("SELECT sum(((p.uploaded - p.uploadoffset )) / (
				unix_timestamp(p.last_action) - unix_timestamp(p.started))) AS speed FROM peers p INNER
				JOIN users u ON p.userid=u.id WHERE u.id=$user[id]");
				$tu=mysql_fetch_array($speedu);
				$speeduu = mksize($tu["speed"])or sqlerr(__FILE__, __LINE__);

				print("<tr><td class=tabletitle colspan=2><center><b>Statistik von ".htmlspecialchars($user["username"])."</b></center></td></tr><tr>");
				
				print("<tr><td class=tableb with=1%><font color=green>UL Speed</font></td><td class=tablea align=left with=99%>  $speeduu</td></tr>\n");
				
				$speedd = mysql_query("SELECT sum(((p.downloaded - p.downloadoffset )) / (
				unix_timestamp(p.last_action) - unix_timestamp(p.started))) AS speed FROM peers p INNER
				JOIN users u ON p.userid=u.id WHERE u.id=$user[id]");
				$td=mysql_fetch_array($speedd);
				$speeddd = mksize($td["speed"])or sqlerr(__FILE__, __LINE__);
				
				print("<tr><td class=tableb><font color=red>DL Speed</font></td><td class=tablea align=left with=99%>  $speeddd </td></tr>\n");
				
				//-------------Real Uplod-Download Speed by StiFFa Ende----------------------

                           if ($CURUSER["dsl_speed"] == "0")
                           print("<tr><td class=tableb>DSL Leitung</td><td class=tablea align=left><font color=red>Keine Angaben</font></a></td></tr>\n");
                           else
                           print("<tr><td class=tableb>DSL Leitung</td><td class=tablea align=left>$user[dsl_speed]</a></td></tr>\n");
				
				if ($user["id"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR)  {?>
				<?php
					////////////PORTANZEIGE + AGENT ANZEIGE///////////////
					$res66 = mysql_query("SELECT agent, port FROM peers WHERE userid=$user[id]")or sqlerr(__FILE__, __LINE__);
					$arr66 = mysql_fetch_assoc($res66);
					$agent66 = "$arr66[agent]";
					$port66 = "$arr66[port]";
					?>
					<tr><td class=tableb>Letzter Port</font></td><td class=tablea align=left><?=$port66?></td></tr>

<tr><td class=tableb>Bandbreite</font></td><td class=tablea align=left>Upload: <b><?=$user["uplspeed"]?>  kb/s</b> | Download: <b><?=$user["downspeed"]?>  Mbit</b> | Provider: <b><?=$user["isp"]?></td></tr>
<tr><td class=tableb><?=$user["username"]?></td><td class=tablea align=left><b> Hat Unseren Tracker Endeckt Durch: <? if ($CURUSER["werbung"] == "0") {?> Keine angaben <?php } else { ?><?=$user["werbung"]?><? } ?></b></center></td></tr>
<?php
// PC Nachts aus begin
if ($user["id"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR)  {
}
if ($user["pcoff"] == 'yes')
{
  print("<tr><td class=\"tableb\" width=1%>PC ist Nachts</td><td class=tablea align=left width=99%><font color=\"green\"><b>an</b></font></td></tr>");
}
else if ($user["pcoff"] == 'no')
     {
       print("<tr><td class=\"tableb\" width=1%>PC ist Nachts</td><td class=tablea align=left width=99%><font color=\"red\"><b>aus</b></font></td></tr>");
     }
     else
     {
       print("<tr><td class=\"tableb\" width=1%>PC ist Nachts</td><td class=tablea align=left width=99%><font color=\"blue\"><b> keine Information</b></font></td></tr>");
     }
// PC Nachts aus Ende

?>


					<?php
					$res5 = mysql_query("SELECT connectable FROM peers WHERE userid=$user[id]")or sqlerr(__FILE__, __LINE__);
					if($row = mysql_fetch_row($res5)){
					$connect = $row[0];
					if($connect == "yes"){
					$connectable = "<a title='Alles O.K! Gute Verbindung!'><b><font color=green>Du bist Connectable</a></font></b>";
					}else{
					$connectable = "<b><a title='Wenn du st&auml;ndig nicht connectable bist, hast du lokale Probleme!'><font color=red>Du bist nicht Connectable</a></font></b>";
					}
					}else{
					$connectable ="<b><a title='Unbekannt'><font color=blue>Keine Connections zur Zeit</font></a></b>";
					}
					?>
					<tr><td class=tableb>Connectable</font></td><td class=tablea align=left><?=$connectable?></td></tr>
					<tr><td class=tableb>Letzter Klient</font></td><td class=tablea align=left><?=$agent66?></td></tr>
					<? } ?>
					<tr><td class=tableb>Hochgeladen</td><td class=tablea align=left><?=mksize($user["uploaded"])?> <?=$upped_per_day?><?php
					if(get_user_class()>=UC_MODERATOR){
					echo "&nbsp;&nbsp;&nbsp;<a href=\"userstraffic.php?id=$user[id]\">Traffic-Details</a>";
					}?></td></tr>
					<tr><td class=tableb>Runtergeladen</td><td class=tablea align=left><?=mksize($user["downloaded"])?> <?=$down_per_day?></td></tr>
					<?php
					if ($user["downloaded"] > 0) {
					$sr = $user["uploaded"] / $user["downloaded"];
					if ($sr >= 10)
						$s = "pirate2";
					else if ($sr >= 7.5)
						$s = "bow";
					else if ($sr >= 5)
						$s = "yikes";
					else if ($sr >= 3.5)
						$s = "w00t";
					else if ($sr >= 2)
						$s = "grin";
					else if ($sr >= 1)
						$s = "smile1";
					else if ($sr >= 0.9)
						$s = "innocent";
					else if ($sr >= 0.5)
						$s = "noexpression";
					else if ($sr >= 0.25)
						$s = "sad";
					else if ($sr >= 0.1)
						$s = "cry";
					else
						$s = "shit";
					$sr = floor($sr * 1000) / 1000;
					$sr = "<table border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><span class=" . get_ratio_color($sr) . ">" . number_format($sr, 3) . "</span></td><td class=embedded>&nbsp;&nbsp;<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "smilies/$s.gif\"></td></tr></table>";
					print("<tr><td class=tableb style='vertical-align: middle'>Ratio</td><td class=tablea align=left valign=center style='padding-top: 1px; padding-bottom: 0px'>$sr</td></tr>\n");
					


					if (file_exists($GLOBALS["BITBUCKET_DIR"] . "/rstat-" . $user["id"] . ".png"))
						print("<tr><td class=tableb style='vertical-align: middle'>Ratio-Histogramm</td><td class=tablea align=left valign=center style='padding-top: 1px; padding-bottom: 0px'><img src=\"" . $GLOBALS["BITBUCKET_DIR"] . "/rstat-" . $user["id"] . ".png\"></td></tr>\n");
					}

					print("<tr><td class=tableb>Kommentare</td>");
					if ($torrentcomments && (($user["class"] >= UC_POWER_USER && $user["id"] == $CURUSER["id"]) || get_user_class() >= UC_MODERATOR))
					{
					print("<td class=tablea align=left><a href=userhistory.php?action=viewcomments&id=$id>$torrentcomments</a></td></tr>\n");
					}
					else{
					print("<td class=tablea align=left>$torrentcomments</td></tr>\n");
					}
					if (get_user_class() >= UC_MODERATOR){
					print("<tr><td class=tableb>Announce-URL</td><td class=tablea align=left>$announceurl</td></tr>");}
					//Abfrage Seederbonus
					$bonus = number_format($user['seedbonus'], 1);
					//Ende
////////INVITESHACK /////////
if (get_user_class() >= UC_USER) {
$res9 = mysql_query("SELECT username FROM users WHERE id = $user[invitedby]");
$arr9 = mysql_fetch_array($res9);
$invby = $arr9["username"];
if ($user["invitedby"] >= 1)
print("<tr><td class=tableb>Invited von</td><td class=tablea align=left><a href=/userdetails.php?id=$user[invitedby]>$invby</a></td></tr>\n");
print("<tr><td class=tableb>Invites</td><td class=tablea align=left>Du hast noch: <a href=/invite.php><b><font color=red>$user[invites]</font></b></a> Invites frei.</td></tr>\n");
}
////////INVITESHACK /////////
?>

<tr><td class=tableb>Spielkonto</td><td class=tablea align=left><?=mksize($user["konto"])?></td></tr>
<?php


if ($CURUSER["id"] != $user["id"]) {

// BEGIN: GB verschenken
  if ($CURUSER["konto"]>"0") {
    ?>
    <form action="takekonto.php" method="post">
    <input type="hidden" name="destid" value="<?=$user["id"]?>"/>
    <tr valign=top><td class=tableb>GBs schenken</td><td class=tablea align=left>
    <input type="text" name="gbgift"/>
    <select name="gbfaktor">
    <option value="1024">MB</option>
    <?php if($CURUSER["konto"]>0) { ?>
    <option value="1048576">GB</option>
    <?php } ?>
    </select>
    &nbsp;von deinem Spielkonto verschenken (wird Dir abgezogen!)<br/>
    Max: <?=mksize($CURUSER["konto"])?><br/>
    <input type=submit class=btn style="height: 23px" value="Spenden"/>
    </td></tr>
    </form>
    <?php
  }
// ENDE: GB verschenken

	/*****************************************************
  ** Uploader Auszeichnung by luni
  *****************************************************/

$ausz = $user["uploaded"];
$auszpic = "auszeichung";


if ($ausz >= 644245094400)   // = 600 GB

  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
  </td>
 </tr>
</table>";

else 

if($ausz >= 536870912000) // = 500 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 429496729600) // = 400 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 375809638400) // = 350 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 322122547200) // = 300 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 268435456000) // = 250 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 214748364800) // = 200 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 161061273600) // = 150 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 107374182400) // = 100 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

if($ausz >= 53687091200) // = 50 GB
  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "$auszpic.gif\">
   </td>
  </tr>
 </table>";

else 

  $ausz = "<table border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td class=embedded>
    <b>Noch Keine Auszeichnung erreicht</b>
   </td>
  </tr>
 </table>";
print("<tr>");
print("<td class=tableb style='vertical-align: middle'>Upload <br> Auszeichnung");
print("</td>");
print("<td class=tablea align=left valign=center style='padding-top: 1px; padding-bottom: 0px'>$ausz");
print("</td></tr>\n");
if ($user["geschlecht"] == "Keine")
print("<tr><td class=tableb>Geschlecht</td><td class=tablea align=left><img src=pic/disabled.gif <font color=red><b> Keine Angaben </b></font></a></td></tr>\n");
else
if ($user["geschlecht"] == "Weiblich")
print("<tr><td class=tableb>Geschlecht</td><td class=tablea align=left><img src=pic/female.gif  alt=Weiblich border=0 /> </a></td></tr>\n");
else
if ($user["geschlecht"] == "Männlich")
print("<tr><td class=tableb>Geschlecht</td><td class=tablea align=left><img src=pic/male.gif  alt=Männlich border=0 /> </a></td></tr>\n");
if ($user["gender"] == "Keine")
print("<tr><td class=tableb>Familienstand</td><td class=tablea align=left><img src=pic/disabled.gif <font color=red><b> Keine Angaben </b></font></a></td></tr>\n");
else
if ($user["gender"] == "Singel")
print("<tr><td class=tableb>Familienstand</td><td class=tablea align=left><img src=pic/female.gif  alt=Singel border=0 /> </a></td></tr>\n");
else
if ($user["gender"] == "Vergeben")
print("<tr><td class=tableb>Familienstand</td><td class=tablea align=left><img src=pic/male.gif  alt=Vergeben border=0 /> </a></td></tr>\n");

/*****************************************************
  ** Uploader Auszeichnung by luni END
  *****************************************************/				

/* Stats by PGoku A */
        $seedsarr = @mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS `cnt` FROM `peers` WHERE `userid`=" . $user["id"] . " AND `seeder`='yes'"));
        $seeds = $seedsarr["cnt"];
        $leechesarr = @mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS `cnt` FROM `peers` WHERE `userid`=" . $user["id"] . " AND `seeder`='no'"));
        $leeches = $leechesarr["cnt"];
        $tlimits = get_torrent_limits($user);

        if ($tlimits["seeds"] >= 0) {
            if ($tlimits["seeds"] - $seeds < 1)
                $seedwarn = " style=\"background-color:red;color:white;\"";
            $tlimits["seeds"] = " / " . $tlimits["seeds"];
        } else
            $tlimits["seeds"] = "";
        if ($tlimits["leeches"] >= 0) {
            if ($tlimits["leeches"] - $leeches < 1)
                $leechwarn = " style=\"background-color:red;color:white;\"";
            $tlimits["leeches"] = " / " . $tlimits["leeches"];
        } else
            $tlimits["leeches"] = "";
        if ($tlimits["total"] >= 0) {
            if ($tlimits["total"] - $leeches + $seeds < 1)
                $totalwarn = " style=\"background-color:red;color:white;\"";
            $tlimits["total"] = " / " . $tlimits["total"];
        } else {
            $tlimits["total"] = "";
	 }

print("<tr><td class=tableb>max Aktive S/L</td><td  class=tablea> Seeds (".$seeds . $tlimits[seeds].") | Leeches (".$leeches . $tlimits[leeches].") | Gesammt: (".($seeds + $leeches) . $tlimits[total].")</td></tr>\n");
/* Stats by PGoku E */

					}
					?>
			</table>
		</td>
	</tr>
	<tr>
		<td width=50% align=left valign="top" class="tableb">
		
			<?php
				if ($CURUSER["id"] != $user["id"]) {
					if (get_user_class() >= UC_GUTEAM) {
						$showpmbutton = true;
						$showemailbutton = true;
					}
					else {
						if ($user["acceptpms"] == "yes") {
							$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
							$showpmbutton = (mysql_num_rows($r) == 1 ? false : true);
						}
						elseif ($user["acceptpms"] == "friends") {
							$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
							$showpmbutton = (mysql_num_rows($r) == 1 ? true : false);
						} 
				
					if ($user["accept_email"] == "yes") {
						$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
						$showemailbutton = (mysql_num_rows($r) == 1 ? false : true);
					}
					elseif ($user["accept_email"] == "friends") {
						$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__, __LINE__);
						$showemailbutton = (mysql_num_rows($r) == 1 ? true : false);
					} 
					} 
				} 

				if ($showpmbutton || $showemailbutton || get_user_class() >= UC_USER) {
					?>
					<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=right>
					<tr><td class=tabletitle colspan=3><center><b>Kontakt</b></center></td></tr><tr>
					<?php
					if (get_user_class() >= UC_MODERATOR || $CURUSER["id"] == $user["id"]){
						print("<tr><td class=tableb>E-Mail</td><td colspan=2 class=tablea align=left><a href=mailto:$user[email]>$user[email]</a></td></tr>\n");
					}
						if ($user["icq"])
							print("<tr><td class=tableb>ICQ</td><td colspan=2 class=tablea align=left><img src=pic/messenger/icq.gif  alt=icq border=0 /> $user[icq] </td></tr>\n");  
						if ($user["msn"])
							print("<tr><td class=tableb>MSN</td><td colspan=2 class=tablea align=left><img src=pic/messenger/msn.gif alt=msn border=0 /> $user[msn]</td></tr>\n");
						if ($user["aim"])
							print("<tr><td class=tableb>AIM</td><td colspan=2 class=tablea align=left><img src=pic/messenger/aim.gif alt=aim border=0 /> $user[aim]</td></tr>\n");
						if ($user["yahoo"])
							print("<tr><td class=tableb>Yahoo</td><td colspan=2 class=tablea align=left><img src=pic/messenger/yahoo.gif alt=yahoo border=0 /> $user[yahoo]</td></tr>\n");
						if ($user["skype"])
							print("<tr><td class=tableb>Skype</td><td colspan=2 class=tablea align=left><img src=pic/messenger/skype.gif alt-skype border=0 /> $user[skype]</td></tr>\n");
				}
					
					print("<tr><td class=\"tablea\" colspan=\"2\" style=\"text-align:center\">");
			
				if ($showpmbutton)
					print('<form method="get" action="messages.php" style="display:inline"><input type="hidden" name="action" value="send"><input type="hidden" name="receiver" value="' . $user["id"] . '"><input type="submit" value="Nachricht senden" style="height: 23px"></form>&nbsp;');
			
				if ($showemailbutton)
					print('<form method="get" action="email-gateway.php" style="display:inline"><input type="hidden" name="id" value="' . $user["id"] . '"><input type="submit" value="E-Mail senden" style="height: 23px"></form>&nbsp;');
				
					print('<form method="post" action=report.php?user='.$user["id"].' style="display:inline"><input type=submit value=Report style="height: 23px"></form>');
				print ("</td></tr>");
				print("</table>");
				 
			?>
		</td>
		<td width=50% align=right  valign="top" class="tableb">
		<?php if($user["id"] == $CURUSER["id"] || get_user_class() >= UC_SYSOP) { ?>
		<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=right>
				<tr><td class=tabletitle colspan=2><center><b>Adressen</b></center></td></tr><tr>
			<?php
				/////////Warnungs Anzeige Doppelte Account mit Ip by Sobe///////////A/////
$ipto = mysql_query("SELECT COUNT(id) FROM `users` AS iplist WHERE `ip` = '" . $user["ip"] . "'") or sqlerr(__FILE__, __LINE__);
$row12 = mysql_fetch_row($ipto);
$ipuse = $row12[0];

if ($user["dipok"] == 'no' ){
if ($ipuse == 1)
{
$use = "";

} else
{
$ipcheck=$user["ip"];
$use =  "<b>(<font color=red>Warnung IP:</font> <a href=usersearch.php?ip=$ipcheck>Wird benutzt von $ipuse verschiedenen Mitgliedern!</a>)</b>";

if ($activated == "yes") {
    tr_msg("Moderatoren benachrichtigen");
    // Send team message
    $mod_msg = "[b]Der Benutzer [url=".$DEFAULTBASEURL."/userdetails.php?id=".$CURUSER["id"]."]".$CURUSER["username"]."[/url] hat warscheinlich einen Doppel account  (".$id.")\n\nBitte überprüfen und verwarnen/löschen.";
}
}
if (get_user_class() >= UC_MODERATOR){
if ($addr)
print("<tr><td class=tableb>Addresse</td><td class=tablea align=left>$addr&nbsp;$use</td></tr>\n");
}
}
/////////Warnungs Anzeige Doppelte Account mit Ip by SoBe////E///////

if ($peer_addr)
    print("<tr><td class=tableb>Peer-Adressen</td><td class=tablea align=left>$peer_addr</td></tr>\n");
///////////////////////////Bad-User Doppelaccount Anzeige by SoBe///////////////////A////////////////////////
$uidres = mysql_query("SELECT DISTINCT(`chash`) FROM `accounts` WHERE `userid`=" . $user["id"]);
                $acccnt = 0;
                while ($chash = mysql_fetch_assoc($uidres)) {
                    $ucntarr = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS `cnt` FROM `accounts` WHERE `chash`=" . sqlesc($chash["chash"]) . " AND `userid`<>" . $user["id"]));
                    $acccnt += $ucntarr["cnt"];
                }
if ($acccnt >0){
    print("<tr><td class=tableb>Ehem. Accs</td><td class=tablea align=left><a href=\"startstoplog.php?op=acclist&amp;id=$id\"><font color=red><b>Achtung Ehemalige Accounts Vorhanden  ($acccnt Stck.)</b></font></a></td></tr>\n");
    }
///////////////////////////Bad-User Doppelaccount Anzeige by SoBe////////////////////E///////////////////////

				
				// if ($user["id"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR)
				// {
				
				?>
		
		</table>
		<? } ?>
		</td>
	</tr>

<!-- BEGIN: Groups Edition by truenoir | Edited by PGoku -->
<?php if ($groups){?>
	<tr>
	<td width="100%" align=left valign="top" class="tableb" colspan="2">
		
		<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=right>
		<tr>
		<td class=tabletitle colspan=2><center><b>Member of</b></center></td>
		</tr>
				<?php
				print("$groups");
				?>
	</table>

<?php
}

if ($grpsel)
{
?>
<form action="taketeams.php" method="post">
<input type="hidden" name="destid" value="<?=$user["id"]?>"/>
<input type="hidden" name="act" value="useradd"/>
    <tr valign=top>

    </td>
    </tr>
</form>
<?php
}
?>
<!-- END: Groups Edition by truenoir | Edited by PGoku -->

	<?php
	//print("go on");
	?>

<tr>
<td width="100%" align=left valign="top" class="tableb" colspan="2">

<!-- /* Signaturbox Hack by PGoku A */ -->
<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%" align=right>
<tr>
<td class=tabletitle colspan=2><center><b>Signatur</b></center></td>
</tr>
<tr>
<td align=left colspan=2 class=tableb>

<?php
if($user["info"] != "")
{
print("".format_comment($user["info"])."\n");
}
else
{
print("<center><b>".$user["username"]."</b> hat noch keine Signatur.</center>\n");
}
?>

</td>
</tr>				
</table>
<!-- /* Signaturbox Hack by PGoku E */ -->

</td>	
</tr>

</table>
<!-- Ende neues Design-->






<table cellspacing="1" cellpadding="5" border="0" class="tableinborder" style="width: 100%">

<?php

if ($torrents)
    print("<tr valign=top><td class=tableb>Hochgeladen</td><td class=tablea align=left>$torrents</td></tr>\n");
if ($seeding)
    print("<tr valign=top><td class=tableb>Seedet&nbsp;momentan</td><td class=tablea align=left>$seeding</td></tr>\n");
if ($leeching)
    print("<tr valign=top><td class=tableb>Leecht&nbsp;momentan</td><td class=tablea align=left>$leeching</td></tr>\n");
if ($completed) {
    print("<tr valign=top><td class=tableb><a name=\"completed\"></a>");
    if (!$_GET["allcompleted"])
        print("Letzte 3 fertige Torrents<br><a class=\"sublink\" href=\"userdetails.php?id=$id&amp;allcompleted=1#completed\">[Alle anzeigen]</a></td><td class=tablea align=left>$completed</td></tr>\n");
    else
        print("Alle fertigen Torrents<br><a class=\"sublink\" href=\"userdetails.php?id=$id#completed\">[Liste verbergen]</a></td><td class=tablea align=left>$completed</td></tr>\n");
} 

}
print("</table></td></tr></table><br>\n");


////////////////////////////////////EDIT USER////////////////////////////////////////////
if ((get_user_class() >= UC_MODERATOR && $user["class"] < get_user_class()) || get_user_class() == UC_SYSOP) {

    ?>
<script type="text/javascript">
function togglediv()
{
    var mySelect = document.getElementById('tselect');
    var myDiv = document.getElementById('tlimitdiv');

    if (mySelect.options[mySelect.selectedIndex].value == "manual")
        myDiv.style.visibility = 'visible';
    else
        myDiv.style.visibility = 'hidden';
    }
</script>


<script type="text/javascript">
function togglepic(bu, picid, formid)
{
    var pic = document.getElementById(picid);
    var form = document.getElementById(formid);
    
    if(pic.src == bu + "/pic/plus.gif")
    {
        pic.src = bu + "/pic/minus.gif";
        form.value = "minus";
    }else{
        pic.src = bu + "/pic/plus.gif";
        form.value = "plus";
    }
}
</script>



<?php
    $bbfilecount = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt FROM bitbucket WHERE user=$id"));
// BEGIN: Groups Edition by truenoir
    $resteams=mysql_query("select * from teams order by sort");
    $selectgroup="";
    while($teams=mysql_fetch_assoc($resteams))
    {
      $selectgroup.="<option value=$teams[id]>$teams[name] (".ucfirst($teams[typ]).")</option>";
    }
    if($selectgroup) $selectgroup="<select name=team><option value=0>Kein Team</option>$selectgroup</select>";
// END: Groups Edition by truenoir
    begin_frame("Profil bearbeiten", false, "750px");
    print("<form method=post action=modtask.php>\n");
    print("<input type=hidden name='action' value='edituser'>\n");
    print("<input type=hidden name='userid' value='$id'>\n");
    print("<input type=hidden name='returnto' value='userdetails.php?id=$id&" . SID . "'>\n");
    print("<table class=tableinborder border=0 cellspacing=1 cellpadding=4 style=\"width:100%;\">\n");
    print("<tr><td class=tableb>PM senden</td><td colspan=2 class=tablea align=left><a href=messages.php?action=send&amp;receiver=".$user['id']."><b>Hier</b></a> klicken um dem User eine PN zu senden.</tr>\n");
    ////USERNAME CHANGE
    if (get_user_class() >= UC_SYSOP) {
    print("<tr><td class=tableb>Email senden</td><td colspan=2 class=tablea align=left><a href=email-gateway.php?id=".$user['id']."><b>Hier</b></a> klicken um dem User eine email zu senden.</tr>\n");
    print("<tr><td class=tableb>Username ändern</td><td colspan=2 class=tablea align=left><input type=text size=52 name=username value=\"" . htmlspecialchars($user[username]) . "\"></tr>\n");   
    
    /////PW CHANGE////
    print("<tr><td class=tableb>Passwort ändern</td><td colspan=2 align=left class=tablea><input type=\"password\" name=\"chpassword\" size=\"52\" /></td></tr>\n");
    print("<tr><td class=tableb>Passwort wdh.  </td><td colspan=2 align=left class=tablea><input type=\"password\" name=\"passagain\" size=\"52\" /></td></tr>\n");

    print("<tr><td class=tableb>Titel</td><td class=tablea colspan=2 align=left><input type=text size=60 name=title value=\"" . htmlspecialchars($user[title]) . "\"></tr>\n");
    $info = htmlspecialchars($user["info"]);
    print("<tr><td class=tableb>Users&nbsp;Info</td><td class=tablea colspan=2 align=left><textarea cols=60 rows=6 name=info>$info</textarea></td></tr>\n");
    print("<tr><td class=tableb>E-mail ändern</td><td colspan=2 align=left class=tablea><input type=text size=52 name=email value=\"" . htmlspecialchars($user[email]) . "\"></tr>\n");
// BEGIN: Groups Edition by truenoir
    if($selectgroup)
      print("<tr><td class=tableb>Groupzuweisung</td><td class=tablea colspan=2 align=left>$selectgroup</td></tr>\n");
// END: Groups Edition by truenoir
}
    ////AVATAR edit////
    $avatar = htmlspecialchars($user["avatar"]);
    print("<tr><td class=tableb>Avatar&nbsp;URL</td><td class=tablea colspan=2 align=left><input type=text size=52 name=avatar value=\"$avatar\"></tr>\n");
    print("<tr><td class=tableb>Start/Stop&nbsp;Events</td><td class=tablea colspan=2 align=left><a href=\"startstoplog.php?op=user&amp;uid=" . $user["id"] . "\">Ereignisse anzeigen</a></td></tr>\n");
    if ($bbfilecount["cnt"]) {
        print("<tr><td class=tableb>BitBucket</td><td class=tablea colspan=2 align=left><a href=\"bitbucket.php?id=$id\">BitBucket-Inhalt dieses Benutzers anzeigen / bearbeiten</a> (" . $bbfilecount["cnt"] . " Datei(en))</tr>\n");
}
    // we do not want mods to be able to change user classes or amount donated...
    if ($CURUSER["class"] < UC_ADMINISTRATOR)
        print("<input type=hidden name=donor value=$user[donor]>\n");
    else {
        print("<tr><td class=tableb>Gespendet</td><td class=tablea colspan=2 align=left><input type=radio name=donor value=yes" . ($user["donor"] == "yes" ? " checked" : "") . ">Ja <input type=radio name=donor value=no" . ($user["donor"] == "no" ? " checked" : "") . ">Nein</td></tr>\n");
//BEGIN: Webseeder, ADSL & Promoter
if(get_user_class()>=UC_MODERATOR)
      print("<tr><td class=tableb>Webseeder</td><td class=tablea colspan=2 align=left><input type=checkbox name=webseed value=yes" . ($user["webseed"] == "yes" ? " checked" : "") . "> Dieser User ist ein Webseeder</td></tr>\n");
      print("<tr><td class=tableb>ADSL2 User</td><td class=tablea colspan=2 align=left><input type=checkbox name=adsl value=yes" . ($user["adsl"] == "yes" ? " checked" : "") . "> Dies ist ein ADSL2 User</td></tr>\n");
      print("<tr><td class=tableb>Promoter</td><td class=tablea colspan=2 align=left><input type=checkbox name=promoter value=yes" . ($user["promoter"] == "yes" ? " checked" : "") . "> Dieser User ist ein Promoter</td></tr>\n");
print("<tr><td class=tableb>VDSL User</td><td class=tablea colspan=2 align=left><input type=checkbox name=vdsl value=yes" . ($user["vdsl"] == "yes" ? " checked" : "") . "> Dies ist ein VDSL User</td></tr>\n");
//ENDE: Webseeder, ADSL & Promoter 
// BEGIN: Tracker Dj
if(get_user_class()>=UC_MODERATOR)
      print("<tr><td class=tableb>Tracker Dj</td><td class=tablea colspan=2 align=left><input type=checkbox name=dj value=yes" . ($user["dj"] == "yes" ? " checked" : "") . "> Diesen User als Tracker Dj setzen</td></tr>\n");
// ENDE: Tracker Dj 
 
// BEGIN: Lieblings user
if(get_user_class()>=UC_MODERATOR)
      print("<tr><td class=tableb>Regel Verstosser!</td><td class=tablea colspan=2 align=left><input type=checkbox name=love value=yes" . ($user["love"] == "yes" ? " checked" : "") . "> Diesen User auf Regel Verstosser setzen</td></tr>\n");
      print("<tr><td class=tableb>Abwesend</td><td class=tablea colspan=2 align=left><input type=checkbox name=wech value=yes" . ($user["wech"] == "yes" ? " checked" : "") . "> Dieses Teammitglied auf abwesend setzen</td></tr>\n");
// ENDE: Lieblings user  




if($beobachtung == 'no')
{
print("<tr><td class=tableb>User beobachten</td><td class=tablea colspan=2 align=left><input type=checkbox name=beobachtung value=1> User beobachten</td></tr>\n");
}
elseif($beobachtung == 'yes')
{
print("<tr><td class=tableb>Beobachtung:</td><td class=tablea colspan=2 align=left>Dieser User wird bereits von $beobachtet_von beobachtet!</td></tr>");
}



// BEGIN: Account parken
if(get_user_class()>=UC_MODERATOR)

      print("<tr><td class=tableb>Account Parken</td><td class=tablea colspan=2 align=left><input type=checkbox name=parked value=yes" . ($user["parked"] == "yes" ? " checked" : "") . "> Diesen User auf Account Parken setzen</td></tr>\n");
// ENDE: Account parken
    }
// BEGIN: Anonymous Torrent Liste by truenoir
	    if($user["class"]<get_user_class()||get_user_class()>=UC_SYSOP)
	
      print("<tr><td class=tableb>Anonym</td><td class=tablea colspan=2 align=left><input type=checkbox name=anon value=yes" . ($user["anon"] == "yes" ? " checked" : "") . "> Wird bei den Torrents als Anonym aufgelistet</td></tr>\n");
// ENDE: Anonymous Torrent Liste by truenoir


    if (get_user_class() == UC_MODERATOR && $user["class"] > UC_VIP)
        printf("<input type=hidden name=class value=$user[class]\n");
    else {
        print("<tr><td class=tableb>Klasse</td><td class=tablea colspan=2 align=left><select name=class>\n");
        if (get_user_class() == UC_MODERATOR)
            $maxclass = UC_VIP;
        elseif (get_user_class() == UC_SYSOP)
            $maxclass = UC_SYSOP;
        else
            $maxclass = get_user_class() - 1;
        for ($i = 0; $i <= $maxclass; ++$i)
        if (get_user_class_name($i) != "")
            print("<option value=$i" . ($user["class"] == $i ? " selected" : "") . ">$prefix" . get_user_class_name($i) . "\n");
        print("</select></td></tr>\n");
    }
    /*
    if (get_user_class() >= UC_ADMINISTRATOR) {
    $zuständig = htmlspecialchars($user["zuständig"]);
    print("<tr><td class=tableb>Zuständig für:<br><font color=red>Wird dann im Teambereich angezeigt!!!!<br>Nur ab Uploader aufwärts ausfüllen</font></td><td class=tablea colspan=2 align=left><textarea cols=70 rows=3 name=zuständig>$zuständig</textarea></td></tr>\n");
    }
    */
    print("<tr><td class=tableb>Torrentbegrenzung</td><td class=tablea colspan=2 align=left><select id=\"tselect\" name=\"limitmode\" size=\"1\" onchange=\"togglediv();\">");
    print("<option value=\"auto\"" . ($user["tlimitall"] == 0?" selected=\"selected\"":"") . ">Automatisch</option>\n");
    print("<option value=\"unlimited\"" . ($user["tlimitall"] == -1?" selected=\"selected\"":"") . ">Unbegrenzt</option>\n");
    print("<option value=\"manual\"" . ($user["tlimitall"] > 0?" selected=\"selected\"":"") . ">Manuell</option>\n");
    print("</select><div id=\"tlimitdiv\" style=\"display: inline;" . ($user["tlimitall"] <= 0?"visibility:hidden;":"") . "\">&nbsp;&nbsp;&nbsp;");
    print(" Seeds: <input type=\"text\" size=\"2\" maxlength=\"2\" name=\"maxseeds\" value=\"" . ($user["tlimitseeds"] > 0?$user["tlimitseeds"]:"") . "\">");
    print(" Leeches: <input type=\"text\" size=\"2\" maxlength=\"2\" name=\"maxleeches\" value=\"" . ($user["tlimitleeches"] > 0?$user["tlimitleeches"]:"") . "\">");
    print(" Gesamt: <input type=\"text\" size=\"2\" maxlength=\"2\" name=\"maxtotal\" value=\"" . ($user["tlimitall"] > 0?$user["tlimitall"]:"") . "\">");
    print("</div></td></tr>\n");

    $res = mysql_query("SELECT msg,name,torrent_id,`status` FROM nowait LEFT JOIN torrents ON torrents.id=torrent_id WHERE user_id=$id");

    if (mysql_num_rows($res)) {
        print("<tr><td class=tableb>Wartezeit&nbsp;aufheben</td><td class=tablea colspan=2 align=left><table");
        print("<table class=tableinborder border=0 cellspacing=1 cellpadding=4 width=\"100%\">");
        print("<tr><td class=tablecat width=\"100%\">Torrent / Grund</td><td class=tablecat>Status</td></tr>\n");
        while ($arr = mysql_fetch_assoc($res)) {
            print("<tr><td class=tablea><p><b><a href=\"details.php?id=$arr[torrent_id]\">" . htmlspecialchars($arr["name"]) . "</a></b></p><p>" . htmlspecialchars($arr["msg"]) . "</td>");
            if ($arr["status"] == "pending") {
                print("<td class=tableb valign=\"middle\" nowrap=\"nowrap\"><input type=\"radio\" name=\"wait[$arr[torrent_id]]\" value=\"yes\"" . ($arr["status"] == "granted"?" checked=\"checked\"":"") . "> Akzeptieren<br/>");
                print("<input type=\"radio\" name=\"wait[$arr[torrent_id]]\" value=\"no\"" . ($arr["status"] == "rejected"?" checked=\"checked\"":"") . "> Ablehnen<br/>\n");
                print("<input type=\"radio\" name=\"wait[$arr[torrent_id]]\" value=\"\"" . ($arr["status"] == "pending"?" checked=\"checked\"":"") . "> Nichts tun</td></tr>\n");
            } else {
                print("<td class=tableb valign=\"middle\" align=\"center\">" . ($arr["status"] == "granted"?"Akzeptiert":"Abgelehnt") . "</td></tr>\n");
            }
        }
        print("</table></td></tr>\n");
    }
 
//Start Up&Download ändern

    ?>

<script type="text/javascript">

function togglepic(bu, picid, formid)
{
    var pic = document.getElementById(picid);
    var form = document.getElementById(formid);
    
    if(pic.src == bu + "/pic/plus.gif")
    {
        pic.src = bu + "/pic/minus.gif";
        form.value = "minus";
    }else{
        pic.src = bu + "/pic/plus.gif";
        form.value = "plus";
    }
}

</script>
<?
  // start upload download boxes //
  if (get_user_class() >= UC_ADMINISTRATOR) {
  print("<tr><td class=tableb>Upload ändern</td><td class=tablea align=center><img src='/pic/plus.gif' id=uppic onClick=togglepic('$BASEURL','uppic','upchange')> <input type=text name=amountup size=10><td class=tablea><select name=formatup>\n<option value=mb>MB</option>\n<option value=gb>GB</option></select>\n</td></tr>");
  print("<tr><td class=tableb>Download ändern</td><td class=tablea align=center><img src='/pic/plus.gif' id=downpic onClick=togglepic('$BASEURL','downpic','downchange')> <input type=text name=amountdown size=10><td class=tablea><select name=formatdown>\n<option value=mb>MB</option>\n<option value=gb>GB</option></select>\n</td></tr>");  
  
}
//Ende Up&Download ändern

///////////////////////Mod-Kommentare Editieren by bliZZarD for BT-Technik-Source////ANFANG////////////////////////////

print("<tr><td class=tableb>Kommentare</td><td class=tablea colspan=2 align=left><div
style=\"width:100%;height:150px;overflow:auto;\">");
begin_table(TRUE);
print("<tr><td class=tabletitle colspan=10><center><b>Mod-Kommentare von ".htmlspecialchars($user["username"])."</b></center></td></tr><tr>");
print("<td class=tablecat>Datum</td><td class=tablecat>Von</td><td class=tablecat>Kommentar</td>");
if (get_user_class() >= UC_ADMINISTRATOR) {
print("<td class=tablecat>Löschen</td>");
}
print("</tr>\n");
$modcommentres = mysql_query("SELECT
`modcomments`.`id`,`modcomments`.`added`,`modcomments`.`userid`,`modcomments`.`moduid`,`modcomments`.`txt`,`users`.`username` FROM
`modcomments` LEFT JOIN `users` ON `users`.`id`=`modcomments`.`moduid` WHERE `userid`=$id ORDER BY `added` DESC");
while ($comment = mysql_fetch_assoc($modcommentres)) {
    $comment["added"] = str_replace(" ", "&nbsp;", $comment["added"]);
    print("<tr><td class=\"tablea\" valign=\"top\">".$comment["added"]."</td>\n<td class=\"tableb\" valign=\"top\">");
    if ($comment["moduid"] == 0)
    print("System");
    elseif ($comment["username"] == "")
    print("<i>Gelöscht</i>");
    else
    print("<a href=\"userdetails.php?id=".$comment["moduid"]."\">".$comment["username"]."</a>");
    print("</td>\n");
    print("<td class=\"tablea\" valign=\"top\">".format_comment(stripslashes($comment["txt"]))."</td>");
    if (get_user_class() >= UC_ADMINISTRATOR) {
    print("<td bgcolor=#FF0000><center><input type=\"checkbox\" name=\"delmodcom[]\" value=\"".$comment["id"]."\" /></center></td>");
    }
    print("</tr>\n");
}

if (mysql_num_rows($modcommentres) == 0){
echo "<tr><td colspan=\"5\" class=tablea style=\"text-align:left;vertical-align:middle;\"><center>Keine Mod-Kommentare Vorhanden</center></td></tr>\n";
}
print("</table></div><br>Hinzufügen:&nbsp;&nbsp;<input type=\"text\" size=\"50\" name=\"modcomment\"></td></tr>\n");

///////////////////////Mod-Kommentare Editieren by bliZZarD for BT-Technik-Source////ENDE////////////////////////////
   
    $warned = $user["warned"] == "yes";

    print("<tr><td class=tableb" . (!$warned ? " rowspan=4": " rowspan=3") . ">Verwarnt</td>
<td class=tablea align=left width=20%>" . ($warned ? "<input name=warned value='yes' type=radio checked>Ja<input name=warned value='no' type=radio>Nein" : "Noch nicht verwarnt") . "</td>");

if ($warned)
{
$warneduntil = $user['warneduntil'];
if ($warneduntil == '0000-00-00 00:00:00')
            print("<td class=tablea align=center>(willkürliche Dauer)</td></tr>\n");
        else {
            print("<td class=tablea align=center>Bis $warneduntil");
            print(" (noch " . mkprettytime(strtotime($warneduntil) - time()) . ")</td></tr>\n");

}


    } else {
        print("<td class=tablea>Verwarnen für <select name=warnlength>\n");
        print("<option value=0>------</option>\n");
        print("<option value=1>1 Woche</option>\n");
        print("<option value=2>2 Wochen</option>\n");
        print("<option value=4>4 Wochen</option>\n");
        print("<option value=8>8 Wochen</option>\n");
        print("<option value=255>Unbefristet</option>\n");
        print("</select></td></tr>\n");
        print("<tr><td class=tablea colspan=2 align=left>PM Kommentar (BBCode erlaubt):<br><textarea cols=\"60\" rows=\"4\" name=\"warnpm\"></textarea><br>");
        print("<input id=\"addwarnratio\" type=\"checkbox\" name=\"addwarnratio\" value=\"yes\"><label for=\"addwarnratio\">&nbsp;Ratiostats zu Mod-Kommentar hinzufügen</label></td></tr>");
    }

$elapsedlw = get_elapsed_time(sql_timestamp_to_unix_timestamp($user["lastwarned"]));
if ($CURUSER[id] == $user[id] || get_user_class() >= UC_MODERATOR )

print("<tr><td class=tableb>Anzahl Verwarnungen</td><td class=tablea align=left>$user[timeswarned]</td></tr>\n");

if ($user["timeswarned"] == 0) {
print("<tr><td class=tableb>Zuletzt verwarnt</td><td class=tablea align=left>Bis jetzt nicht.</td></tr>\n");
}else{
if ($user[warnedby] != "System") {
$res = mysql_query("SELECT id, username FROM users WHERE id =".$user[warnedby]."") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$warnedby = "[von <u><a href=userdetails.php?id=".$arr['id'].">".$arr['username']."]</u>";
}else{
$warnedby = "[by System]";
}
print("<tr><td class=tableb>Zuletzt verwarnt</td><td class=tablea align=left>$user[lastwarned]&nbsp;(vor $elapsedlw&nbsp;)&nbsp;&nbsp;&nbsp;$warnedby</td></tr>\n");
}
if($beobachtung == 'no')
{
print("<tr><td class=tableb>User beobachten</td><td class=tablea colspan=2 align=left><input type=checkbox name=beobachtung value=1> User beobachten</td></tr>\n");
}
elseif($beobachtung == 'yes')
{
print("<tr><td class=tableb>Beobachtung:</td><td class=tablea colspan=2 align=left>Dieser User wird bereits von $beobachtet_von beobachtet!</td></tr>");
}
    if (get_user_class() >= UC_ADMINISTRATOR) {
print("<tr><td class=tableb>Seedbonus</td><td class=tablea colspan=2 align=left><input type=text size=5 name=seedbonus value=\"" . htmlspecialchars($user[seedbonus]) . "\"></tr>\n");
    
$supportfor = htmlspecialchars($user["supportfor"]);
print("<tr><td class=tableb>Support</td><td class=tablea colspan=2 align=left><input type=radio name=support value=yes" .($user["support"] == "yes" ? " checked" : "").">Ja<input type=radio name=support value=no" .($user["support"] == "no" ? " checked" : "").">Nein</td></tr>\n");
print("<tr><td class=tableb>Support für:</td><td class=tablea colspan=2 align=left><textarea cols=60 rows=6 name=supportfor>$supportfor</textarea></td></tr>\n");
}
if (get_user_class() >= UC_ADMINISTRATOR) {
$dipcomment = htmlspecialchars($user["dipcomment"]);
print("<tr><td class=tableb>Erlaube Doppel-IP</td><td class=tablea colspan=2 align=left><input type=radio name=dipok
value=yes" . ($user["dipok"] == "yes" ? " checked" : "") . ">Ja <input type=radio name=dipok value=no" . ($user["dipok"] == "no" ? " checked" : "") . ">Nein</td></tr>\n");
print("<tr><td class=tableb>Begründung der D-IP Freigabe:</td><td class=tablea colspan=2 align=left><textarea cols=60
rows=2 name=dipcomment>$dipcomment</textarea></td></tr>\n");
}
// Nichterreichbar und doch Saugen // Anfang //
print("<tr><td class=tableb>Nicht Erreichbar doch Saugen</td><td class=tablea colspan=2 align=left><input name=con value='no' type=radio" . ($con ? " checked" : "") . ">Ja <input name=con value='yes' type=radio" . (!$con ? " checked" : "") . ">Nein  <br>Hier kannst du User die nicht Erreichbar sind doch Saugen lassen</td></tr>\n");
// Nichterreichbar und doch  Saugen // Ende //  
//Anfang:Shoutbox Postings erlauben bzw verbieten
print("<tr><td class=tableb>Shoutbox eintäge erlauben</td><td class=tablea colspan=2 align=left> <input name=shoutpost value='no' type=radio" . (!$shoutpost ? " checked" : "") . ">Nein<input name=shoutpost value='yes' type=radio" . ($shoutpost ? " checked" : "") . ">Ja</td></tr>\n");
//Ende:Shoutbox Postings erlauben bzw verbieten


    print("<tr><td class=tableb>Muss Regeln bestätigen</td><td class=tablea colspan=2 align=left><input name=acceptrules value='no' type=radio" . ($acceptrules ? " checked" : "") . ">Ja <input name=acceptrules value='yes' type=radio" . (!$acceptrules ? " checked" : "") . ">Nein</td></tr>\n");
    print("<tr><td class=tableb>Torrent-Upload sperren</td><td class=tablea align=left colspan=2><input name=denyupload value='yes' type=radio" . (!$allowupload ? " checked" : "") . ">Ja <input name=denyupload value='no' type=radio" . ($allowupload ? " checked" : "") . ">Nein</td></tr>\n");
    print("<tr><td class=tableb>Bad User <img src=\"" . $GLOBALS["PIC_BASE_URL"] . "help.png\" style=\"vertical-align:middle;\" title=\"Bewirkt, dass dieser Benutzer nur ungültige Peer-IPs erhält\" alt=\"Bewirkt, dass dieser Benutzer nur ungültige Peer-IPs erhält\"></td><td class=tablea align=left><input name=baduser value='yes' type=radio" . ($baduser ? " checked" : "") . ">Ja <input name=baduser value='no' type=radio" . (!$baduser ? " checked" : "") . ">Nein</td><td class=tablea align=left><a href=\"startstoplog.php?op=acclist&amp;id=$id\">Liste ehem. Accounts anzeigen</a></td></tr>\n");
    print("<tr><td class=tableb>Aktiviert</td><td class=tablea align=left><input name=enabled value='yes' type=radio" . ($enabled ? " checked" : "") . ">Ja <input name=enabled value='no' type=radio" . (!$enabled ? " checked" : "") . ">Nein</td><td class=tablea align=left>Grund: <input type=text name=disablereason size=40></td></tr>\n");
    print("<tr><td class=tableb>Eintragen zu BAD-User-Liste</td><td class=tablea colspan=2 align=left><a href=addshitlist.php?id=$user[id]&ime=$user[username]&email=$user[email]>Eintragen</a></td></tr>\n");
if (get_user_class() >= UC_ADMINISTRATOR) {
    print("<tr><td class=tableb>PassKey<td class=tablea colspan=2 align=left><input type=checkbox name=chpasskey value=1> <b>PassKey des Users neu generieren.</b></td></tr>\n");
    print("<tr><td class=tableb><b>Account<b></td><td class=tablea colspan=2 align=left><a href=delacctadmin.php?name=$user[username]>löschen</a></td></tr>\n");
    print("</td></tr>");
}
    print("<tr><td class=tablea colspan=3 align=center><input type=submit class=btn value='Okay'></td></tr>\n");
    print("</table>\n");
    print("<input type=hidden id=upchange name=upchange value=plus><input type=hidden id=downchange name=downchange value=plus>");
    print("</form>\n");
    end_frame();
}
end_main_frame();
echo "</center>";
stdfoot();

?></center>