the link to the login page goes on any page that you want the user to be able to access the login page from.
for the accesscheck to function, the login forms action needs to also pass the querystring variabel.
On the login page, change the form tag:
<form action="<?php echo ($_SERVER["PHP_SELF"]);?>" method="post" id="WAATKLogInForm">
to:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>" method="post" id="WAATKLogInForm">