<?php
include("connect.php");
include("login_cookies.php");

while($admin = mysql_fetch_array($db_admin)) {

if ($_COOKIE["pass"] == md5($admin["kodeord"])) {

 if ($admin["admin"] == "1") {

	if ($admin["exist"] == "1") {

if ($_GET["deactivate"] == "true" && isset($_GET[id])) {

mysql_query("UPDATE `pytox_community` SET `exist` = '0' WHERE `id` LIKE '{$_GET[id]}'");

print "Brugeren er nu deaktiveret og kan ikke logge ind!";

} else if ($_GET["activate"] == "true" && isset($_GET[id])) {

mysql_query("UPDATE `pytox_community` SET `exist` = '1' WHERE `id` LIKE '{$_GET[id]}'");

print "Brugeren er nu aktiveret igen og kan logge ind igen!";

} else {
?>
<table class="blackborder" cellpadding="0" cellspacing="1" style="width:500px;">
 <tr>
  <td align="left" style="width:200px;">
<strong>Bruger:</strong>
  </td>
  <td align="right" style="width:300px;">
<strong>Mulighed:</strong>
  </td>
 </tr>
<?php
while($user = mysql_fetch_array($db_users)) {

print "<tr>";

if ($user[exist] == "1") {
print "<td align=\"left\" style=\"width:200px;border-bottom:1px solid #000;\"><a href=\"?site=Com.users&user=".$user[bruger]."\" style=\"color:#063;\">".$user[bruger]."</a></td>";
} else if ($user[exist] == "0") {
print "<td align=\"left\" style=\"width:200px;border-bottom:1px solid #000;\"><a href=\"?site=Com.users&user=".$user[bruger]."\" style=\"color:#F00;\">".$user[bruger]."</a></td>";
} else {
print "ERROR!";
}

if ($user[exist] == "1") {
print "<td align=\"right\" style=\"width:300px;border-bottom:1px solid #000;color:#00F;\"><a href=\"?site=Userlist&amp;deactivate=true&amp;id=".$user[id]."\" style=\"color:#063;\">Deaktiver denne bruger</a></td>";
} else if ($user[exist] == "0") {
print "<td align=\"right\" style=\"width:300px;border-bottom:1px solid #000;color:#F00;\"><a href=\"?site=Userlist&amp;activate=true&amp;id=".$user[id]."\" style=\"color:#F00;\">Aktiver denne bruger</a></td>";
} else {
print "ERROR!";
}

print "</tr>";
}
?>
</table>
<?php
}

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

 }

}

}

?>