I would approach this with include():
<html>
<head>
<title>This is my welcome page</title>
</head>
<body>
<?php
if (isset($_COOKIE['secret_value_already_set'])) {
print "<a href=\"somepage.php\">Click here</a> to enter the site!";
} else {
include("login_page.php");
}
?>
</body>
</html>
Then 'login_page.php' just needs to generate the body content for your login form, eventually setting the cookie value required to enter the site (after successful auth).
Really, i prefer to have all pages run through a master index.php, and just include the page requested - that way you can check the auth details every time a page is loaded before serving any content.
So
print "<a href=\"somepage.php\">Click here</a> to enter the site!";
Becomes
print "<a href=\"index.php?page=somepage\">Click here</a> to enter the site!";