a buddy told me to use this..

PHP Code:
<?php 
if (!isset($_GET["link"])) include 'main.php';
else if(
is_file($_GET["link"] . ".php") && $_GET["link"] !="index" ) include htmlspecialchars($_GET["link"] . ".php");
else include 
'error.php';
?>
seems to work how i wanted