PEAR Articles

  Home arrow PEAR Articles arrow Page 2 - Building an Authors Page for a PEAR CM...
PEAR ARTICLES

Building an Authors Page for a PEAR CMS
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-11-12

    Table of Contents:
  • Building an Authors Page for a PEAR CMS
  • The Code Explained
  • HTML Table
  • Extracting Author Information

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Building an Authors Page for a PEAR CMS - The Code Explained


    (Page 2 of 4 )



    The script starts by making the usual checks concerning the status of the currently logged-on user. The checks are done in this way: a session is started, using PHP’s session_start() function, which starts or opens a session. Currently our session contains only two variables, the author_name and the access level of a user.

    The security check that is done by the script uses the author_name session variable that is available to the entire application. It checks to see if that variable is set or if it exists. If the variable is set, then it means that the currently logged-in user is authenticated and should be allowed to view the page. On the other hand, if the session variable is not set, the user will be redirected to the login page:


    <?php

    session_start();

    if(!isset($_SESSION['author_name'])){

    //redirect to login page

    header("location:login.php");

    }

    ?>


    The next part of the page starts to build the HTML portion of the script. The HTML code will also include a table that will eventually host the dynamic content that we want to display:


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

    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Untitled Document</title>

    <!-- InstanceEndEditable -->

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

    <link href="Templates/pear.css" rel="stylesheet" type="text/css" />

    </head>


    <body>

    <table width="100%" border="0" class="bord">

    <tr class="header1">

    <td colspan="2"><div align="center">Content Management System </div></td>

    </tr>

    <tr>

    <td width="5%" valign="top"><!-- InstanceBeginEditable name="EditRegion4" -->

    More PEAR Articles Articles
    More By David Web

    blog comments powered by Disqus

    PEAR ARTICLES ARTICLES

    - Installing PEAR
    - PEAR: an Introduction
    - Managing robots.txt using PHP: Generating Dy...
    - Deleting Authors from a PEAR Content Managem...
    - PEAR CMS: Index and Delete Scripts
    - Listing Articles for a PEAR Content Manageme...
    - Building an Authors Page for a PEAR CMS
    - Building the View Details Page in a PEAR CMS
    - Creating the Main Pages of a PEAR CMS
    - Completing the Login Script for a PEAR CMS
    - User Authentication for a PEAR CMS
    - A PEAR CMS: Examining the Code
    - Building a Content Management System with PE...
    - Installing a PEAR Package
    - My PEAR: The Beginning


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap