tags:

views:

48

answers:

2

whats going on is everything is loading just fine url is deigned.sytes.net except for the links when i click about us or services or contact they look like there loading but the content in body.tpl doesn't change from default. maybe you can help me with this why the links are not changing. you u want here are the ONLY php files

I have made phps files for view perpose's but if you insist on it i will post the require code.

designed.sytes.net/index.phps designed.sytes.net/classes/file.class.phps

A: 

I see in your http://designed.sytes.net/classes/file.class.phps file you have $_GET['page'] but on the query string you have p=

an example of what does not work is:

http://designed.sytes.net/index.php?p=about

and then changed to:

http://designed.sytes.net/index.php?page=about

seems to show something different.

John Boker
+1  A: 

In the URLs you name the parameter p but in your files.class.php you actually test for $_GET['page']. So either change the URLs to use page as parameter or change the code to:

// in files.class.php instead of if(!isset($_GET['page']))
if(!isset($_GET['p'])){
    // your code here...
} else {
   // ...
} 

In your original code, as $_GET['page'] does never exist, it always shows the index page.


Another thing that looks strange to me is the following (but maybe it is just how you set it up):

if(file_exists($_GET['page'].'.txt')){
    // and lets include that then:
    ob_start();
    include("contents/". $_GET['page'] . '.php');
    $content = ob_get_contents();
    ob_end_clean();
}

You first check whether the text file e.g. about.txt exists but then include a PHP file contents/about.php. Is this intended? Does the PHP always exist if the text file exists?


UPDATE:

Also make sure that you properly check the value that you get from $_GET['page'] or however you call it in the end.
E.g. this call http://designed.sytes.net/index.php?page=../index seems to kill your server (sorry it was unintentionally :( )

UPDATE 2:
In order to provide "some" security you could check whether $_GET['page'] is one of predefined values instead of checking whether a file with this name exists. E.g:

$valid_pages = array('home', 'about', 'services', 'contact');

if(isset($_GET['page']) && in_array($_GET['page'], $valid_pages) {
   // include page here
}
else {
    // redirect to home page
}

That makes sure that $_GET['page'] is not of form of relative pathes like ../index. If it is not one of those values in $valid_pages you redirect to the home page.

Felix Kling
look what you did.
John Boker
@John Boker: Ah its working again :)
Felix Kling
hehe so that was you thanks sorry about that no i didn't update the phps with the fix made them all .php instead of .txt and thank you that now make perfect sense of why it wasn't loading maybe you can help me with a z-index level not being applied i'll add it to the content above
s32ialx
@s32ialx: See my updated answer regarding this "security issue".
Felix Kling
@s32ialx: Regarding the z-index: If you remove the `z-index` from the element with ID `mains` than the menu is correctly shown above the content in Firefox 3.6.
Felix Kling
@Felix thanks for that security tip i'll implement that soon just having a mindf with this css issue where my tables aren't styling with the built in styles in the table tags themselves
s32ialx