Jump to content

Help with navigation site


b0lero
Go to solution Solved by ginerjm,

Recommended Posts

Hey guys I'am new to this and i have idea how to do my counter strike web site :) got some design at the moment and im gonna try to explain to you what i want to do so :) .

 

post-179150-0-08852500-1453923602_thumb.jpg

 

i use 


<?php
$homepage = file_get_contents('stats.php');
echo $homepage;
?>

to include another web pages only into black space . At the moment when u are in HOME PAGE in the black space its shown stats.php ... but how to make it when i click to NEWS to show me news.php whithout changing the page ? 

 

Sorry for my stupid explanation :)

Link to comment
Share on other sites

All i want its to be simply cos the web site its local , so nobody will try do broke the security. All i want its to move from page to page from my navigation and to show the contant into a frame may be with AJAX and JavaScript will be too much. Thank You Very Much

Link to comment
Share on other sites

Is a few things should consider doing so has no errors.

 

first check if $_GET['page'] is actually set with isset()

next would be to check if that php file exists you are including with is_file() or file_exists()

if(isset($_GET['page'])){

    $page = trim($_GET['page']);

        if(is_file($page.".php")){

            include($page.".php");

        }

}

You can further make an array of only the pages want to allow

$allowed = array("home","about","contact","stats");

if(isset($_GET['page'])){

$page = trim($_GET['page']);

if(in_array($page,$allowed)){
        if(is_file($page.".php")){

            include($page.".php");

        }
}
}

Can add any else statements you desire, such as always include home.php as the default page if page is not set in the url

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.