<?php ob_start();?>
<script type="text/javascript">

function tag(id) {
document.getElementById(id).style.display = "inline";
}

function addtag() {
if (document.getElementById("addtag").style.display == "none") {
document.getElementById("addtag").style.display = "block";
} else if (document.getElementById("addtag").style.display == "block") {
document.getElementById("addtag").style.display = "none";
}
}

</script>
<?php
$get_user_check = mysqL_query("SELECT * FROM `pytox_community` WHERE `id` LIKE '{$_GET[userid]}' LIMIT 1");
$get_user = mysqL_query("SELECT * FROM `pytox_community` WHERE `id` LIKE '{$_GET[userid]}' LIMIT 1");

$userid = mysql_query("SELECT * FROM `pytox_community` WHERE `id` LIKE '{$_GET[userid]}' LIMIT 1");
while ($id = mysql_fetch_array($userid)) {
$get_gb = mysqL_query("SELECT * FROM `pytox_gb` WHERE `til` LIKE '{$id["bruger"]}' AND `show` LIKE '1' ORDER BY `id` DESC");
}


if (mysql_num_rows($get_user_check) == 0) {

print "<strong>Brugeren med id'et ".$_GET[userid]." kunne ikke findes i databasen!</strong>";

} else {
?>
<a href="?site=Com.users&amp;userid=<?php print $_GET[userid];?>">Brugerens-info</a> - <a href="?site=Com.users&amp;userid=<?php print $_GET[userid];?>&amp;choose=gb">Gæstebog</a> - <a href="?site=Pmail&amp;emne=Intet emne&amp;touser=<?php print $_GET[userid];?>">Send en Pmail</a>
<br />
<br />
<?php
while($db_users = mysql_fetch_array($get_user)) {

if ($_GET["choose"] == "gb") {
?>
<strong>Gæstebog</strong>
<br />
<br />
<a href="javascript:void(0)" onClick="addtag()">Vis/skjul beskedfelt</a>
<br />
<br />
<div id="addtag" class="blackborder" style="display:none;padding:2px;width:350px;">
<?php

while($check_logon_com = mysql_fetch_array($db_community)) {

if ($_COOKIE[pass] == md5($check_logon_com[kodeord]) && $_COOKIE[com] == "1") {
?>
<form action="?site=Com.users&amp;userid=<?php print $_GET[userid];?>&amp;choose=addtag" method="post">
Besked:
<br />
<textarea name="message" cols="30" rows="7"></textarea>
<br />
<br />
<input type="submit" name="submit" value="Skriv" class="submit" onClick="goShow('writingto')" />
<br />
<div id="writingto" style="display:none;">
Skriver...
</div>
</form>
<?php
} else if (mysql_num_rows($db_community) == 0) {
print "Du skal være logget på, før du kan se communityet!";
} else {
print "Du skal være logget på, før du kan se communityet!";
}
}
?>
</div>
<br />
<br />
<table class="blackborder" style="border-bottom:1px solid #000;background-color:#EEE;color:#000;width:500px;" cellpadding="2" cellspacing="1">
<?php
if (mysql_num_rows($get_gb) == 0) {
?>
 <tr>
  <td>
Der er ingen beskeder i gæstebogen
  </td>
 </tr>
<?php
} else {

while ($tag = mysql_fetch_array($get_gb)) {

$userid = mysql_query("SELECT * FROM `pytox_community` WHERE `bruger` LIKE '{$tag[fra]}' LIMIT 1");

	while ($taguid = mysql_fetch_array($userid)) {
?>
 <tr>
  <td style="border-bottom:1px dashed #000;" align="top">
Fra: <a href="?site=Com.users&userid=<?php print $taguid[id];?>"><?php print $tag[fra];?></a>, <?php print $tag[tid];?>
<br />
<a href="javascript:void(0)" onClick="tag('t<?php print $tag[id];?>')">Se beskeden</a>
<br />
<br />
<div id="t<?php print $tag[id];?>" class="blackborder" style="display:none;">
<?php print $tag[besked];?>
</div>
<br />
<br />
  </td>
 </tr>
<?php
	}
}// afslutter while
}//afslutter tjek om der er beskeder
?>
</table>
<?php
} else if ($_GET["choose"] == "addtag") {

print "Stadium 1";

$community = mysql_query("SELECT * FROM `pytox_community` WHERE `bruger` LIKE '{$_COOKIE[user]}' ORDER BY `bruger` ASC") or die(mysql_error());

while($useren = mysql_fetch_array($community)) {

print "Stadium 2";

 if ($_POST["message"] != "") {

print "Stadium 3";

$replace["message"] = str_replace("Ø", "&Oslash;", $_POST["message"]);
$replace["message"] = str_replace("ø", "&oslash;", $replace["message"]);
$replace["message"] = str_replace("Å", "&Aring;", $replace["message"]);
$replace["message"] = str_replace("å", "&aring;", $replace["message"]);
$replace["message"] = str_replace("Æ", "&Aelig;", $replace["message"]);
$replace["message"] = str_replace("æ", "&aelig;", $replace["message"]);

$useridget = mysql_query("SELECT * FROM `pytox_community` WHERE `id` LIKE '{$_GET[userid]}' LIMIT 1") or die(mysql_error());

 while ($imdu = mysql_fetch_array($useridget)) {

print "Stadium \"Inside\"";

mysql_query("INSERT INTO `pytox_gb` (`id`, `ip`, `show`, `fra`, `til`, `tid`, `besked`) VALUES ('', '{$_SERVER[REMOTE_ADDR]}', '1', '{$_COOKIE[user]}', '{$imdu[bruger]}', '{$tid}', '{$replace[message]}')") or die(mysql_error());

 }

$location = "Location: index.php?site=Com.users&userid=".$_GET[userid]."&choose=gb";

print "Beskeden er oprettet gæstebogen, der ejes af brugeren med id'et: ".$_GET[userid].".";

header($location);

 } else {

print "Stadium 4";

 header("Location: index.php?message=failure&errorid=27173");
 }

}

} else {

?>
<strong>Brugernavn:</strong> <?php print $db_users[bruger]; ?>
<br />
<strong>Status:</strong>&nbsp;
<?php
if ($db_users[admin] == "1" && $db_users[crew] == "1") {
print "Administrator, Crewmedlem";
} else if ($db_users[admin] == "1") {
print "Administrator";
} else if ($db_users[crew] == "1") {
print "Crewmedlem";
} else {
print "Normal";
}
?>
<br />
<strong>Navn:</strong> <?php print $db_users[navn]; ?>
<br />
<strong>Alder:</strong> <?php print $db_users[alder]; ?>
<br />
<?php
if (eregi("+'http://'", $db_users[hjemmeside])) {
$website = $db_users[hjemmeside];
} else {
$website = "http://".$db_users[hjemmeside];
}
?>
<strong>Hjemmeside:</strong> <a href="?site=Redirect&amp;location=<?php print $website; ?>" target="_Blank"><?php print $db_users[hjemmeside]; ?></a>
<br />
<strong>Onlinetid:</strong> 
<?
if ($db_users[timer] < "1") {
print "0";
} else {
print $db_users[timer];
}
?> timer
<br />
<?php
$t = $db_users[timer];

if ($db_users[admin] == "1") {
$lvl = "Administrator";
} else if ($t >= "20000") {
$lvl = "21";
} else if ($t >= "10000") {
$lvl = "20";
} else if ($t >= "5000") {
$lvl = "19";
} else if ($t >= "2500") {
$lvl = "18";
} else if ($t >= "1500") {
$lvl = "17";
} else if ($t >= "1000") {
$lvl = "16";
} else if ($t >= "650") {
$lvl = "15";
} else if ($t >= "450") {
$lvl = "14";
} else if ($t >= "300") {
$lvl = "13";
} else if ($t >= "200") {
$lvl = "12";
} else if ($t >= "140") {
$lvl = "11";
} else if ($t >= "100") {
$lvl = "10";
} else if ($t >= "70") {
$lvl = "9";
} else if ($t >= "50") {
$lvl = "8";
} else if ($t >= "32") {
$lvl = "7";
} else if ($t >= "20") {
$lvl = "6";
} else if ($t >= "12") {
$lvl = "5";
} else if ($t >= "6") {
$lvl = "4";
} else if ($t >= "3") {
$lvl = "3";
} else if ($t >= "1") {
$lvl = "2";
} else if ($t == "0") {
$lvl = "1";
} else {
$lvl = "0";
}
?>
<strong>Level:</strong> <?=$lvl?>
<br />
<br />
<br />
<br />
<br />
<strong>
<?php
if (eregi("$[x_s_z_X_s_Z]", $db_users["bruger"])) {
print $db_users[bruger]."' fritekst";
} else {
print $db_users[bruger]."'s fritekst";
}
?>
</strong>
 <div class="copy" style="display:inline;">(<a href="javascript:;" onClick="goShow('userText');">vis/skjul</a>)</div>:
<br />
<div id="userText" style="display:inline;">
<?php
if ($db_users[exist] == 0) {
?>
<div style="color:#F00;text-decoration:underline;font-weight:bold;">Denne bruger er blevet deaktiveret af administratorerne. Dette vil sige, at han ikke kan logge ind.</div>
<?php
} else {

print strip_tags($db_users[text], "<u><i><b><strong><br>");


}

?>
</div>
<br />
<br />
<strong>Information</strong> <div class="copy" style="display:inline;">(<a href="javascript:;" onClick="goShow('userInformation')">vis/skjul</a>)</div>:
<br />
<div id="userInformation" style="display:inline;">
<?php
$users_tag = mysql_query("SELECT * FROM `pytox_tagwall` WHERE `user` LIKE '{$db_users[bruger]}'");

print "Skrevne beskeder i tagwallen: ".mysql_num_rows($users_tag);
?>
<br />
<?php
$users_gb = mysql_query("SELECT * FROM `pytox_gb` WHERE `fra` LIKE '{$db_users[bruger]}' AND `show` LIKE '1'");

print "Skrevne beskeder i g&aelig;steb&oslash;ger: ".mysql_num_rows($users_gb);
?>
<br />
<?php
$users_pmail = mysql_query("SELECT * FROM `pytox_post` WHERE `fra` LIKE '{$db_users[bruger]}'");

print "Afsente PMail's: ".mysql_num_rows($users_pmail)." <i>(Hvis denne bruger er administrator medtælles og beskederne, der er sent til alle brugere)</i>";
?>
<br />
<?php
$users_artikler = mysql_query("SELECT * FROM `pytox_artikler` WHERE `forfatter` LIKE '{$db_users[bruger]}' AND `show` LIKE '1'");

print "Skrevede og godkendte artikler: ".mysql_num_rows($users_artikler);
?>
<br />
<?php
$users_nyheder = mysql_query("SELECT * FROM `pytox_nyheder` WHERE `forfatter` LIKE '{$db_users[bruger]}' AND `show` LIKE '1'");

print "Skrevede og godkendte nyheder: ".mysql_num_rows($users_nyheder);
?>
</div>
<br />
<br />
<u><strong>Ekstra information (for administratorer):</strong></u>
<br />
<br />
Pycoins: <?=$db_users[coins]?>
<br />
Kodeordets længde: <?=strlen($db_users[kode])?>
<?php

}

}
}
?>