PHP
  Home arrow PHP arrow Page 6 - Time is Money (part 1)
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Time is Money (part 1)
By: The Disenchanted Developer, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 5
    2001-10-22

    Table of Contents:
  • Time is Money (part 1)
  • Up A Creek
  • Bills, Bills, Bills
  • So Many Tables, So Little Time
  • Open Sesame
  • The Lazy Programmer Strikes Again
  • Today's Menu
  • Too Much Information
  • Time For Bed

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Time is Money (part 1) - The Lazy Programmer Strikes Again


    (Page 6 of 9 )

    Once the user is successfully logged in, "menu.php" takes over and generates a menu of functions available to the user.

    The first thing "menu.php" (and every other script) does is to verify the existence of a valid session - this is necessary to prevent unauthorized users from viewing the pages. If a session doesn't exist, the browser is immediately redirected to the error page.

    <? // check for valid user session session_start(); if(!session_is_registered("SESSION_UID")) { header("Location: error.php?ec=1"); exit; } ?>
    Assuming the session check does not fail, a basic HTML page is built.

    <html> <head> </head> <body bgcolor="white"> <? // display page header $title = "Main Menu"; include("header.inc.php"); ?> <? // code to build main menu goes here ?> <? include("footer.inc.php"); ?> </body> </html>
    Before we get into the nitty-gritty of how "menu.php" works, I want to draw your attention to the manner in which each page within this application is built.

    Each page generated through this application has a particular layout - a logo in the top left corner and a blue bar below it containing a page title. The bottom of every page has a copyright notice and a disclaimer. Since these elements will remain constant, through the application, I've placed the corresponding HTML code in separate header and footer files, and simply include()d them on each page.

    Again, by separating common interface elements into separate files, I've made it easier to customize the look of the application; simply alter these files, and the changes will be reflected on all the pages.

    The variable $title stores the title for each page, and is used by "header.inc.php" - as you can see.

    <!-- header.inc.php --> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td><a href="logout.php"><img src="images/logo.gif" width=131 height=70 alt="" border="0" vspace="5"></a></td> </tr> <tr> <td bgcolor="#3098C3"><font color="white">&nbsp;<b><? echo $title; ?></b></font></td> </tr> </table> <p>

    More PHP Articles
    More By The Disenchanted Developer, (c) Melonfire


     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway