hotdog1983 Posted November 18, 2010 Share Posted November 18, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/219049-efficient-website-design/ Share on other sites More sharing options...
trq Posted November 18, 2010 Share Posted November 18, 2010 1) Includes are included as and sent as part of the 1 initial page. 2) Its html, what is there to secure? 3) See #1 4)As long as you prepend the user input with the pages/ directory you should be fine. Quote Link to comment https://forums.phpfreaks.com/topic/219049-efficient-website-design/#findComment-1135979 Share on other sites More sharing options...
hotdog1983 Posted November 18, 2010 Author Share Posted November 18, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/219049-efficient-website-design/#findComment-1136331 Share on other sites More sharing options...
deadhead Posted November 19, 2010 Share Posted November 19, 2010 It's a very sloppy, unorganized website designing. I recommend you looking into Object Oriented PHP (OOP) scripting, also look into Smarty Template Engine its very cool you can have all you php scripting completely separate from your website layout. Makes editing a breeze! Quote Link to comment https://forums.phpfreaks.com/topic/219049-efficient-website-design/#findComment-1136436 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.