info343/index.php

<?php
   date_default_timezone_set('America/Los_Angeles');
   $PAGE = isset($_GET['page']) ? $_GET['page'] : 'home';
   $CONFIG = json_decode(file_get_contents('course.json'));
   $BASENAME = file_get_contents('basename.txt');
   $PAGES = array('Calendar', 'Lectures', 'Labs', 'Homework', 'Drop Box', 'Syllabus', 'Software', 'Staff');
   
   if (isset($_GET['fragment'])) {
      $headers = apache_request_headers();
      $last_modified = date('r', filemtime("inc/$PAGE.php"));
      if ($headers['If-Modified-Since'] == $last_modified) {
         header('HTTP/1.1 304 Not Modified');
         exit();
      } else {
         header("Last-Modified: $last_modified"); // Sat, 16 Nov 2013 21:17:44 GMT
         require "inc/$PAGE.php";
      }
   } else {
      require "inc/page_top.php";
      // foreach (array_merge(array('Home'), $PAGES) as $page) {
      //    $sanitized = strtolower(str_replace(' ', '', $page));
      /*    ?>
         <div class="page <?= $sanitized ?>">
            <?php
      //       if ($PAGE == $sanitized) {
      //          require "inc/$sanitized.php";
      //       }
      //       ?>
         </div>
         <?php
      //  } */
      require "inc/page_bot.php";
   }
?>