index.php

This file is a trivial one, but it’s necessary nonetheless to give the project a home page. All it does is display a simple welcome message. In a finished application, this would be where you sell the virtues of your site to encourage signups.

Seeing as all the MySQL tables have been created and the include files saved, you can now load Example 21-4, index.php, into your browser to get your first peek at the new application. It should look like Figure 21-1.

Example 21-4. index.php
<?php // index.php
include_once 'header.php';

echo "<br /><span class='main'>Welcome to Robin's Nest,";

if ($loggedin) echo " $user, you are logged in.";
else           echo ' please sign up and/or log in to join in.';

?>

</span><br /><br /></body></html>
The main page of the site
Figure 21-1. The main page of the site

Get Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.