Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4549556
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:22:36+00:00 2026-05-21T16:22:36+00:00

Firstly, I don’t know what to call this thing :) I want to know

  • 0

Firstly, I don’t know what to call this thing 🙂 I want to know the key, structure and example how to achieve my goal.

Example, I don’t want create separate file like register.php, login.php, about.php faq.php. Here I want the register, login about, faq ,etc will handle by index.php by example, maybe something like index.php?p=register

How do I create page something like that and what this structure called in PHP programming. Let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:22:37+00:00Added an answer on May 21, 2026 at 4:22 pm

    To provide a more appropriate answer using Neals code, use basename to filter out non-essential file information:

    $page = isset($_GET['p'])?basename($_GET['p']):'main';
    
    include_once "$page.php";
    

    You could also create a “white list” to ensure that only the proper files get included:

     $whiteList = array('faq', 'register', 'profile'); 
     $page = (isset($_GET['p']) && in_array($_GET['p'], $whiteList))?basename($_GET['p']):'main';
    
     include_once "$page.php";
    

    Both ways should be secure, obviously, the white list will be a bit more so. This tact, depending on how you do is generally referred to as “BootStrapping” IE, one entrance page to access the rest.


    UPDATE

    To further the security, I would set a variable, $included would be sufficient, to add to the pages that are being included. This would prevent direct access to them (assuming that register_globals is turned off like it should be, so something like:

     $whiteList = array('faq', 'register', 'profile'); 
     $page = (isset($_GET['p']) && in_array($_GET['p'], $whiteList))?basename($_GET['p']):'main';
    
     $included = true;
     include_once "$page.php";
    

    Then on $page.php at the top you would have something like:

    <?php
    
    if (!$included)
           die('Accessing the file directly is not allowed.');
    

    Which would prevent calls to http://yoursite.com/register.php from being allowed to dish out the file. This has it’s negatives to it. Instead of putting the files you are going to be including in the webroot, I would put them outside of the webroot or in an .htaccess protected directory, which would ensure that users could not access them directly and must access them through the index.php.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, This might seem like a long question. I don't think it is... The
Firstly, I know this [type of] question is frequently asked, so let me preface
Firstly apologies for the title, I don't know if it describes what I am
I don't know what is wrong here. Firstly It is Winforms application using .net
Firstly, please don't dismiss this question - I'm aware it's an ugly situation but
Firstly, I'm aware of this question , but I don't believe I'm asking the
I don't really know what to entitle this, but I need some help with
firstly i recently installed this program as I’m working on a project to create
firstly I don't which is the correct stackExchange site to post this question if
Firstly to show you what I am trying to achieve in the view, a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.