Some sample code that could be used as a starting point for this
assignment is shown below. This needs to be saved as a PHP file (e.g.,
index.php).
<!-- This is an HTML comment at the beginning of the file identifying the
owner.
Your Name
CS 4312
Lab 01
-->
<?php
/* Check the protocol for this request. Redirect an HTTP request to
an HTTPS request.
Ref.: https://stackoverflow.com/questions/5106313/redirecting-from-http-to-https-with-php
*/
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === "off")
{
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $location);
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="referrer" content="no-referrer-when-downgrade" />
</head>
<body>
<p> Put a paragraph here. Repeat the paragraph tag for additional paragraphs.
Make sure you use the a (anchor) tag and the img (image) tag. Look at the
example toward the bottom of the page.
</p>
<p>
Paragraph 2 ...
</p>
<!-- If you want to insert a PHP code block, do something like the following.
See p.~2ff.
-->
<?php
echo "<p> This is the next paragraph.</p>";
?>
<p>
It's always a good idea to validate your code. By including the following link
and image, a user will be able to click the image and receive a report from
the validator for the current page.
</p>
<p>
<?php
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$location = urlencode($location);
echo '<a href="https://validator.w3.org/nu/?doc=' . $location . '">';
?>
<img src="https://www.w3.org/QA/Tools/I_heart_validator"
alt="I heart Validator logo" height="31" width="80" />
</a>
</p>
</body>
</html>