Jump to content

Efficient website design?


hotdog1983

Recommended Posts

Hi all!

 

I'm a real noob and this is my first time making a website and I haven't hosted it yet.

I'm trying to make a website that is fast and secure.

My pages look something like this.

 

<?php include("header.php");include("sidebar.php"); ?>
HTML CODES
<?php include("footer.php"); ?>

 

1. Are these php files cached after their first load? When I go to another page, those parts seem to stay still.

2. Is this code secure?

 

And now I'm starting to make product pages which will be around 40 pages.

So I'm considering something like  this...

 

<?php include("header.php");include("sidebar.php"); ?>
<a href="index.php?page=a">Page A</a>
<?php 
$page = $_GET['page'];
if (file_exists('pages/'.$page.'.php'))
{
   include('pages/'.$page.'.php');
}
?>
<?php include("footer.php"); ?>

 

3. Is it better to make every page like this since it will load header, sidebar, footer only once?

4. How should I protect from the user input data, by making an array of allowed files or by prohibiting "." and "/" ?

 

Thank you in advance.

Link to comment
Share on other sites

Thanks a lot for your reply.

 

But um... I'm still trying to understand your answer 1)

 

What I understand is that

 

In the 1st code

  The whole page will be reloaded as I surf around the website.

 

In the 2nd code

  Only the content part of the page will be loaded as I surf around the website.

 

 

Is this correct?

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.