<?php
include_once("connect.php");
include_once("menu.php");
$q1 = mysql_query("select * from nickin_brugere order by id");
if($_GET['slet'] == "1"){
if($_SESSION['Rang'] == "Admin"){
mysql_query("delete from nickin_brugere where id = '$_GET[bruger]'");
print "Brugeren blev slettet!";
}
}
if($_GET['admin'] == "1"){
if($_SESSION['Rang'] == "Admin"){
mysql_query("update nickin_brugere set Rang = 'Admin' where id = '$_GET[bruger]'");
print "Brugeren blev gjort til admin!";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="75%" border="0" align="center">
  <tr> 
    <td width="40%">Brugernavn:</td>
    <td width="12%">Point:</td>
    <td width="18%">Sidst set:</td>
    <td width="15%">Rang:</td>
    <?php
	if($_SESSION['Rang'] == "Admin"){
	?>
    <td width="15%">Slet (admin funk.):</td>
	<?php
	}
	?>
  </tr>
</table>
<?php
while($hent = mysql_fetch_array($q1)){
?>
<table width="75%" border="0" align="center">
  <tr> 
    <td width="40%"><a href="profil.php?b=<?php print $hent['brugernavn'] ?>"><?php print $hent['brugernavn'] ?></a></td>
    <td width="12%"><?php print $hent['point'] ?></td>
    <td width="18%"><?php print $hent['sidstset'] ?></td>
    <td width="15%"><?php print $hent['Rang'] ?><?php if($_SESSION['Rang'] == "Admin"){ if($hent['Rang'] != "Admin"){ ?> (<a href="medlemmer.php?admin=1&bruger=<?php print $hent['id'] ?>">g&oslash;r til admin</a>)<?php }} ?></td>
    <?php
	if($_SESSION['Rang'] == "Admin"){
	if($hent['Rang'] != "Admin"){
	?>
    <td width="15%"><a href="medlemmer.php?slet=1&bruger=<?php print $hent['id'] ?>">Slet</a></td>
	<?php
	}else{
	?>
	<td width="15%">-</td>
	<?php
	}
	}
	?>
  </tr>
</table>
<?php
}
?>
</body>
</html>