dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
2
share rss forum feed


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
reply to cdru

Re: Please help me make something like site.com/?p=pagetwo

said by cdru:

said by Ashke:

So far in the index.php page, the echo $page; from line 21 is showing "home" and not the content of the pagetwo, so it's telling me that the php code isn't working. Can someone help me out?

The PHP code is working exactly as it was programmed. Don't mistake the php code not working for you not telling it what you really want to do. :)

Comment out line 12 and I bet your problem disappears.

Attempting to head off problems before they become them, what you are implementing is bad for several reasons. One is security reason because you are passing into PHP unsanitized parameters. Any time you use a user inputted string for building a path or creating a command it should be sanitized in some form to limit what it can do. As it is now, I can pass in anything to request any file with a php extension, regardless if I should be able to access that file and path.

The other thing is more practical. Search engine optimization best practices say not to use query strings as you are using them. It's better to put them in the path and not query string. something like example.com/article/pagetwo is better. URL rewriting can take care of getting rid of the php from the user displayed URL.

So I should do something like generateMenu()?
--
-Ashke