Home arrow PHP arrow Page 6 - Time is Money (part 1)

The Lazy Programmer Strikes Again - PHP

For consultancies that bill on an hourly basis - lawyers,accountants et al - time tracking is a critical part of the billingprocess. For small- and medium-size organizations, resource tracking,allocation and analysis is essential for business efficiency and planning.This article addresses both requirements by teaching you how to build atimesheet system to track and analyze work hours with PHP and MySQL.

TABLE OF CONTENTS:
  1. Time is Money (part 1)
  2. Up A Creek
  3. Bills, Bills, Bills
  4. So Many Tables, So Little Time
  5. Open Sesame
  6. The Lazy Programmer Strikes Again
  7. Today's Menu
  8. Too Much Information
  9. Time For Bed
By: The Disenchanted Developer, (c) Melonfire
Rating: starstarstarstarstar / 5
October 22, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: