PEAR Articles
  Home arrow PEAR Articles arrow Completing the Login Script for a PEAR...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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? 
PEAR ARTICLES

Completing the Login Script for a PEAR CMS
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-10-22

    Table of Contents:
  • Completing the Login Script for a PEAR CMS
  • JavaScript
  • The logout script
  • The CMS

  • 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


    Completing the Login Script for a PEAR CMS


    (Page 1 of 4 )

    Welcome to the sixth part of a twelve-part series on building a content management system with PEAR. In this article we will continue to look at the code that makes up the login script as well as the HTML form that is used to collect the login information. We will also discuss the code that makes up the logout script.

     

    The login form


    The login form is very simple in its design and purpose. Its purpose is to collect the required information from the user. It will take the user's password and username.

    The form has three main fields: Username, which of course takes the user's username; Password, which takes the user's password; and Key. Key is a hidden field that is used to test whether the form has been submitted. It is used because sometimes users press the return key instead of pressing the submit button on the form. If you then use the submit button to test whether the form is submitted, it will not work, especially if the user presses the return key. This way both scenarios are considered. 

    Let’s look at the HTML code that makes up the HTML form. The first part of the form sets up the page with the template and also includes some JavaScript code, which we will discuss shortly. We look at the body section that actually contains the form and its elements:


    <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" --><!-- InstanceEndEditable --></td>

    <td width="95%" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->

    The section builds a table that hosts the form. Notice in the code below that the form tag includes an onSubmit() tag. This tag links the form to the JavaScript code that is located in the header section of the HTML document. 

    <form action="login.php" method="post" onSubmit="return checkform(this)">>

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

    <tr>

    <td colspan="2"><?php if($error){

    echo $error;

    }?></td>

    </tr>

    Please examine the code above the PHP section. This is where the error message will be displayed when an error is detected while the form data is been filtered. The code below shows the username form element that is responsible for collecting the username of the person that wants to use the CMS.

    <tr>

    <td width="15%"><strong>Username</strong></td>

    <td width="85%"><label>

    <input name="uname" type="text" size="40" value="david"/>

    </label></td>

    </tr>

    The next two elements are the password and key fields, responsible for taking the user's password and test key, respectively:

    <tr>

    <td><strong>Password</strong></td>

    <td><label>

    <input name="upass" type="password" value="pass" size="40" />

    <input type="hidden" name="key" />

    </label></td>

    </tr>

    More PEAR Articles Articles
    More By David Web


     

    PEAR ARTICLES ARTICLES

    - 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
    - Using XML_RPC2 with PEAR
    - Using Web Service APIs (Amazon and Yahoo!) w...
    - Database Abstraction with MDB2 from PEAR





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT