dbCMS.php

Source of dbCMS.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
    <title>CS PHP Includes</title>
    <link rel = "stylesheet"
          type = "text/css"
          href = "csStd.css" />
  </head>
<?php

//get pageID from request if possible
$pageID = $_REQUEST["pageID"];
if ($pageID == ""){
  $pageID = 1;
} // end if

//read current page information from the db
$conn = mysql_connect("localhost", "xfd", "xfdaio");
mysql_select_db("xfd");
$pageID = mysql_real_escape_string($pageID, $conn);
$sql = "SELECT * FROM pageView WHERE pageID = $pageID";
$result = mysql_query($sql, $conn);

//populate local variables from db result
while ($row = mysql_fetch_assoc($result)){
  if ($row["block"] == "head"){
    $head = $row["title"];
  } else if ($row["block"] == "menu"){
    $menu = $row["content"];
  } else if ($row["block"] == "content1"){
    $c1Title = $row["title"];
    $c1Text = $row["content"];
  } else if ($row["block"] == "content2"){
    $c2Title = $row["title"];
    $c2Text = $row["content"];
  } else if ($row["block"] == "footer"){
    $footer = $row["content"];
  } // end if
} // end while

?>

  <body>
    <div id = "all">
      <!-- This div centers a fixed-width layout -->
      <div id = "heading">
        <h1>
          <?php print $head; ?>
        </h1>
      </div><!-- end heading div -->
      
      <div id = "menu">
        <?php print $menu; ?>
      </div> <!-- end menu div -->
      
      <div class = "content">
        <h2>
          <?php print $c1Title; ?>
        </h2>
        <p>
          <?php print $c1Text; ?>
        </p>
      </div> <!-- end content div -->
      
      <div class = "content">
        <h2>
          <?php print $c2Title; ?>
        </h2>
        <p>
          <?php print $c2Text; ?>
        </p>
      </div> <!-- end content div -->
      
      <div id = "footer">
        <?php print $footer; ?>
      </div> <!-- end footer div -->     
    </div> <!-- end all div -->
  </body>
</html>