Jump to content

How to do: blah.php?page=blah


Russia

Recommended Posts

How do I do it so like I have a navigation bar with links.

 

Like one link is like

blah.php?page=about

for the about page, and it loads

 

blah.php?p=about

with the about html

 

blah.php?p=index

with the homepage html

 

I dont know whats it called I think its called like dynamic php.

 

Link to comment
https://forums.phpfreaks.com/topic/180211-how-to-do-blahphppageblah/
Share on other sites

You should note, however, that having an open include like that is EXTREMELY unsafe.  Let's say you want someone to put in:

 

blah.php?page=about.html

 

And you have a file called config.php in the same directory, a person could put in:

 

blah.php?page=config.php

 

And get all the information from that page.  Make sure you sanitize your inputs.

Exactly, or if you want to allow the person to access only, say, html files in the same directory, you can read the directory for files, then use a foreach loop to add all pages with an html extension to an array, and there's your dynamically generated allow array.

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.