<?php
session_start();
if($_SESSION['admin'] != 1) {
echo "<center><br><br><br><br><br><br><h1>Du er ikke logget ind!<br><br> <a href='logind.php'>klik her for login</a>";
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vagt oversigt</title>
<style type="text/css">
<!--
body {
background-color: #0099CC;
}
-->
</style></head>
<center><img src="../logo/top.jpg" />
</head>
</head>
<body>
<br />
<a href="login.php">Hoved menu</a>
<center><h2>Stadeplads</h2>
<?php
include 'connect.php';
echo'<center><table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="75"><b>Stadeplads</b></td>
<td width="75"><b>Blok</b></td>
<td width="75"><b>Meter</b></td>
<td width="75"><b>Hjørne grund</b></td>
<td width="75"><b>Tilmelding</b></td>
<td width="75"><b>Ledig</b></td>
<td width="25">Optaget</td>
</tr>';
include_once('mysql2i.class.php');
include_once('mysql2i.func.php');
$result = mysql_query("SELECT * FROM vagt_arrdb WHERE atildelt = 'Stadeplads' ORDER BY Blok")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
//$dato = $row['dato'];
$anavn = $row['anavn'];
//$adag = $row['adag'];
$meter = $row['meter'];
$grund = $row['grund'];
$aid = $row['aid'];
$pladser = $row['pladser'];
$tilmeldt = $row['tilmeldt'];
$Blok = $row['Blok'];
$Stadeplads = $row['Stadeplads'];
//$lpladser=$pladser-$tilmeldt;
$check = mysql_query("SELECT * FROM vagt_tilmdb WHERE arrid = '".$row['aid']."'");
$count = mysql_num_rows($check);
$sCheck = mysql_query("SELECT SUM(meter) as TotalMeter FROM vagt_tilmldb WHERE arrid = '".$row['aid']."'");
$sRow = mysql_fetch_array($sCheck);
echo $sRow['TotalMeter'];
echo '<tr>
<td>'.$Stadeplads.'</td>
<td>'.$Blok.'</td>
<td>'.$meter.'</td>
<td>'.$grund.'</td>
<td><a href="arr.php?aid='.$aid.'">Tilmeld</a></td>
<td>'.$count.'</td>
<td>'.$pladser.'</td>
</tr>';
}
echo'</table>';
}
?>
</body>
</html>
<?php
?>