<?php
/*
* date('w') returns the day of the week as a number:
* 0 is Sunday, 1 is Monday ... 6 is Saturday etc.
*/
if( date('w') === '1' ) {
/*
* This code tells the browser to show a "403" error page.
* 403 is the error code for "Forbidden"!
*/
header('HTTP/1.1 403 Forbidden');
echo "This page can't be read on Mondays";
/*
* The die(); command stops the PHP script immediately!
* No code after this will be run or sent to the browser.
*/
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>The Non-Monday Page</title>
</head>
<body>
<h1>It's not a Monday</h1>
<p>
It's not a Monday, so you can read this page! Lucky you!
</p>
</body>
</html>