Quote Originally Posted by Twey View Post
Code:
<?php
  function inc() {
    $page = isset($_GET['page'])
      ? $_GET['page']
      : 'default';

    if(strpos($page, './') !== false
        || !file_exists($page = 'includes/' . $page . '.inc.php'))
      $page = 'includes/error.inc.php';

    include($page);
  }
?>
Quote Originally Posted by Dazza30 View Post
Hi

Im thinking about learning php, so if you dont mind me asking what does the code above actualy do?
The code above is processing some page defined in a php file as $_GET['page'] or as it would appear in a browser address bar
Code:
http://www.dynamicdrive.com/index.php?page=_page_
If the file is in the correct format, the page / file will be brought into (included) the php file, if not, an error page will be included.