Jump to content

[SOLVED] rewrite and pull question


darkfreaks

Recommended Posts

Current Script:

 

<?php
  // Wherever you keep the page files
  $sub_path = getcwd() . '/portfolio';
  // .php do not change
  $sub_extension = '.php';
  // Page shown by default (filename not url) no need for an array since this script reads all the pages in the directory
  $sub_default = 'stateoftheunion';
  function show_error($msg)
    {
      echo "<h1>Error</h1>\n";
      echo "<span>" . $msg . "</span>\n";
    }
  function sub_include()
    {
      global $sub_path, $sub_extension, $sub_default;
      $sub_filename = isset($_GET['design']) ? $_GET['design'] : $sub_default;
      if (!$sub_filename)
        {
          show_error('No page selected.');
          return;
        }
      foreach (array('.', '/', '\\') as $sub_illegal)
        {
          if (false !== strpos($sub_filename, $sub_illegal))
            {
              show_error('Illegal characters in page parameter.');
              return;
            }
        }
      $sub_fullpath = realpath(sprintf('%s/%s.%s', $sub_path, $sub_filename, $sub_extension));
      if (!file_exists($sub_fullpath))
        {
          show_error('This page has not been created yet.');
          return;
        }
      include($sub_fullpath);
    }
    
?>

 

and when i put

 

<a href="?page=portfolio&design=stateoftheunion">

 

it does not pull up the page at all rather does nothing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.