<?php
if (!isset($_SESSION))
{
	session_start();
}
require_once ('header.php');
if ($aangemeld == "ja")
{
	$res = mysql_query("SELECT * FROM items WHERE cat='11';");
	if (mysql_num_rows($res) >= 1)
	{
		while ($row = mysql_fetch_array($res))
		{
			$prijs = halen("SELECT prijs FROM prijslijst WHERE cat='11' AND catnr='".$row['catnr']."';");
			$money_nu_member = halen("SELECT money FROM members WHERE naam = '".$row['eigenaar']."'");
			$money_nu_member = $money_nu_member + $prijs;
			mysql_query("UPDATE members SET money = '".$money_nu_member."' WHERE naam = '".$row['eigenaar']."';");
			mysql_query("DELETE FROM items WHERE nr='".$row['nr']."';");
		}
	}
}
else
{
	echo "<h1>Nieuws</h1>";
	echo "Oeps! Hiervoor moet je aangemeld zijn!";
}
require_once ('footer.php');
?>