Jump to content
xisto Community
demonlord

Will This Code Work php linking script ?p=

Recommended Posts

hi i'm not that great at php so i'm not to sure if this will work or not. but what i want to do is be able to use ?p=staff or what ever page name, with out the php extion, and i would like to no if this simple script i made would work.

the code is:

<?php $p = $_GET['p'];if ( !empty($p) && file_exists('./' . $p . '.php') && stristr( $p, '.' ) == False ) {// pages = directory where you store your pages   $file = './' . $p . '.php';}else{// 1.php =  defult page   $file = './index.php';}include $file;?>

if there is something wrong with this please let me know

Share this post


Link to post
Share on other sites

It should work fine. I made a little system in a very similar way and it worked fine. Its also good as its simplicity will eliminate a lot of security risks. Systems like this that use DBs have the added risk of SQL injections etc so this method will be a lot more secure.Now you can develop the code more and perhaps make a whole CMS out of it! Good work :)

Share this post


Link to post
Share on other sites

Content Management System, like Joomla or Mambo.What they are trying to say is: keep coding and you will get better...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.