PEAR Articles
  Home arrow PEAR Articles arrow Page 2 - User Authentication for a PEAR CMS
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

User Authentication for a PEAR CMS
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-10-15

    Table of Contents:
  • User Authentication for a PEAR CMS
  • Code Explained
  • String or Numeric
  • Granting Access to 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


    User Authentication for a PEAR CMS - Code Explained


    (Page 2 of 4 )

    The code starts by defining some variables and then checking to see if the form has been submitted:

    <?php

    ob_start();

    session_start();

    $err=false;

    $error="";

    //check if form is submitted

    if(isset($_POST['key'])){

    This line is responsible for checking if the form has been submitted:

    if(isset($_POST['key'])){

     If the "$_POST['key']" global variable has been posted, it means that the form has been submitted. The "$_POST['key']" variable comes from a hidden form field, which we will discuss when looking at the HTML form that collects user input.

    If the form has indeed been submitted, the next step is to make sure that the submitted information is security checked. This step is very important, since most attacks against login scripts are carried out here. So we cannot afford to be lax about security at this juncture.

    Because there is information that we require, it is logical to make sure that the user has submitted that information. We go about checking for this information by using the empty() and is_numeric functions of PHP. First we check to see if the fields are empty. If they are empty, we set a Boolean variable to true:

    //make sure fields are not empty

    if(empty($_POST['uname'])){

    $err=true;

    $error="Please enter a username.<br>";

    }

    if(empty($_POST['upass'])){

    $err=true;

    $error .="Please enter a password.<br>";


    }

    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 2 Hosted by Hostway
    Stay green...Green IT