<?php
if (!isset($_SESSION))
{
	session_start();
}
require_once ('header.php');
echo "<h1>Sitelog</h1>";
if ($aangemeld == "ja")
{
	if (($member_status == "manager") or ($member_status == "staff"))
	{
		if (ISSET($_GET['wis']))
		{
			action("wist de sitelog");
			$datum = date("d.m.Y H:i");
			$filename = date("dmyHi").".txt";
			$fileput = file_get_contents("action.txt")."
"."***** END LOGGING: ".$datum." *****";
			file_put_contents("sitelog/".$filename, $fileput);
			file_put_contents("action.txt", "**** START LOGGING: ".$datum." ****");
			action("wist de sitelog");
		}
		else
		{
			action("bekijkt de sitelog");
		}
		echo "<textarea rows='20' cols='63' wrap='off' readonly>";
		echo file_get_contents("action.txt");
		echo "</textarea>";
		echo "<br><a href='?wis'>Wis sitelog</a>";
	}
	else
	{
		action("probeert zonder rechten de sitelog te bekijken/wissen");
		echo "Oeps! Hiervoor moet je <b>Hotel Manager</b> of <b>Staff Lid</b> zijn.";
	}
}
else
{
	echo "Oeps! Hiervoor moet je aangemeld zijn!";
}
require_once ('footer.php');
?>