Is this a good way to create a dynamic webpage using PHP? -


i'm trying create dynamic webpage using include() in php. php page has following codes - literally, that's file contains:

<?php session_start(); $dbname = $_request['dbname']; $tbname = $_request['tbname']; $dbtype = $_request['dbtype'];  include('header.php'); switch($dbtype) {     case 'calender':         include('calenderpage.php');         exit;     case 'news':         include('newspage.php');         exit;     case 'gallery':         include('gallerypage.php');         exit; } include('footer.php'); ?> 

do think it's way of creating dynamic php page?

what show fine. done bit simpler using array:

<?php session_start(); // explicitly using $_get or $_post better $_request $dbname = $_get['dbname']; $tbname = $_get['tbname']; $dbtype = $_get['dbtype'];  include('header.php');  // sure have array of allowed pages  // people can't access pages they're not supposed access $allowed_pages = array("calender", "news", "gallery");  if (in_array($dbtype, $allowed_pages))  include($dbtype."page.php"); else  die("unknown page");  include('footer.php'); ?> 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -