WebChat follows a standard structure for small and medium sized PHP projects, which is shown in the list below. The base directory contains PHP scripts corresponding to application views that the user will see (login.php, logout.php, register.php, chat.php), while a subdirectory (here named include) contains utility classes for page layout (header.php, footer.php) and a library file (include.php) of classes that do most of the work of the application. Finally the css directory contains our application specific style sheet (chat.css) which makes the generated web pages pretty and helps to avoid cluttering our PHP files with excessive HTML formatting.
We'll discuss each of these files in turn to explain how the application works, with the exception of chat.css, which makes the output prettier, but doesn't affect the way it works. All the files are available in the provided supplemental file Zip file.