PHP
  Home arrow PHP arrow Page 4 - Filters and Login Systems for Web Application Security
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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

Filters and Login Systems for Web Application Security
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2008-10-06


    Table of Contents:
  • Filters and Login Systems for Web Application Security
  • Definition and Storage File
  • The Login page
  • The code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    Filters and Login Systems for Web Application Security - The code
    ( Page 4 of 4 )

    The login script has two methods of validating form data. The first is the JavaScript code that ensures that the user fills in all the data that is required. Then a secondary level of validation is added. This time, PHP does its own checking. and only then will this data be passed to the application.

    JavaScript in itself is not a true security measure, but rather a convenience and also an extra layer of security. This is because JavaScript is a client-side technology (as opposed to PHP, which is server side). It saves the user the hassle of having to submit the form to the server, having it checked by PHP and then sent back if errors occur. What happens instead is that JavaScript checks the form data locally and if the checks are okay, it then sends the information to PHP. There is a small price for this convenience; the PHP file becomes a bit larger in size.

    So why do we need PHP to check the form data if JavaScript does it in the first place? Because, as I’ve already stated, JavaScript is not a security measure in itself, for the simple reason that it can easily be turned off, rendering the code completely useless. The JavaScript code in our form primarily checks to see if the username and password fields in the form are filled in. If so, the data is sent to the PHP script; otherwise, a message box is displayed, alerting the user to the error:


    if(pform1.pw.value=="" && pform1.uname.value==""){

    alert("Please make sure that you have entered your username and password")

    return false

    }

    In the code above, the pform1 refers to the form name and the pw refers to the form field name. The same applies to the uname.value line. The alert message is what the user will see if the form fields are empty.

    In the next article we will continue to explore the login page and also discuss the benefits of authentication from a security point of view.



     
     
    >>> More PHP Articles          >>> More By David Web
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





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