Jump to content

hybridpunk

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hybridpunk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much, that fixed the problem. At first it wasn't working, then I realized that my urls were looking like index.php?page=pages/blah, after deleting pages/ from the url, everything worked fine. I greatly appreciate your help.
  2. I was assuming that the code would pull $page from the URL, I guess I assumed wrong? If so, what would I need to do to fix this?
  3. I have fixed that, and I am still getting the same result, it is always loading the main.txt instead of the pages i am requesting
  4. Basically what I am trying to achieve is making sure any $page called originates from my server, but if no $page is defined, to include a default page I have set up. This is my code, and I cannot figure out what's wrong with it. <?php $path = 'pages/'; $extension = '.txt'; if ( preg_match("#^[a-z0-9_]+$#i",$page) ){ $filename = $path.$page.$extension; include($filename); } if (!$page) include 'pages/main.txt'; ?> An example URL I am using is www.mywebsite.com/index.php?$page=pages/tester What am I doing wrong?
×
×
  • 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.