Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Will This Code Work


5 replies to this topic

#1 demonlord

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 92 posts
  • Gender:Male

Posted 02 January 2008 - 10:56 PM

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

#2 shadowx

    Live your life so that in death you may stand side by side with your gods. Not at their feet.

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1,674 posts
  • Gender:Male
  • Location:Essex, UK
  • Interests:Photography is a big interest, i have some photos up at my site, apex photographs (http://apex-photographs.com). Using my Lumix g1 to take the photos of course! <br /><br />Um computer games... photo editing and thats about it!
  • myCENT:68.57
  • Spam Patrol

Posted 02 January 2008 - 11:08 PM

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 :)

#3 demonlord

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 92 posts
  • Gender:Male

Posted 02 January 2008 - 11:46 PM

thanks. what is CMS?

#4 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 03 January 2008 - 12:42 AM

Content Management System, like Joomla or Mambo.

What they are trying to say is: keep coding and you will get better...

#5 demonlord

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 92 posts
  • Gender:Male

Posted 03 January 2008 - 12:46 AM

ok thanks, i've used Joomla before but i did not know that it was a cms.

#6 gogoily

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 99 posts

Posted 10 January 2008 - 02:15 AM

If those codes are in the "index.php" file, it will work.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users