PHP Dynamic Include Help на Index.php?

Мне нужно, чтобы кто-то дал мне знать решение этой проблемы. Я пытаюсь создать include в моем файле index.php, поэтому, когда пользователь нажимает ссылку на моем навигаторе, содержимое на index.php изменяется. Код ниже отлично работает, за исключением случаев, когда я перехожу к index.php, потому что он не является частью массива, он дважды вызывает main.php, а не один раз. Я знаю, что это из-за последней части, которая гласит:

else { include('main.php'); } 

Однако мне нужно решение, потому что я плохо разбираюсь в php. Вот мой полный код для включения.

  <?php // Place the value from ?page=value in the URL to the variable $page. $page = $_GET['id']; // Create an array of the only pages allowed. $pageArray = array('index','css-pub1','page2','page3','page4','page5','page6'); // If there is no page set, include the default main page. if (!$page) { include('main.php'); } // Is $page in the array? $inArray = in_array($page, $pageArray); // If so, include it, if not, emit error. if ($inArray == true) { include(''. $page .'.php'); } else { include('main.php'); } ?> в  <?php // Place the value from ?page=value in the URL to the variable $page. $page = $_GET['id']; // Create an array of the only pages allowed. $pageArray = array('index','css-pub1','page2','page3','page4','page5','page6'); // If there is no page set, include the default main page. if (!$page) { include('main.php'); } // Is $page in the array? $inArray = in_array($page, $pageArray); // If so, include it, if not, emit error. if ($inArray == true) { include(''. $page .'.php'); } else { include('main.php'); } ?> в  <?php // Place the value from ?page=value in the URL to the variable $page. $page = $_GET['id']; // Create an array of the only pages allowed. $pageArray = array('index','css-pub1','page2','page3','page4','page5','page6'); // If there is no page set, include the default main page. if (!$page) { include('main.php'); } // Is $page in the array? $inArray = in_array($page, $pageArray); // If so, include it, if not, emit error. if ($inArray == true) { include(''. $page .'.php'); } else { include('main.php'); } ?>