Security
  Home arrow Security arrow Page 3 - Lock Down Your Website
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
SECURITY

Lock Down Your Website
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 59
    2004-06-01

    Table of Contents:
  • Lock Down Your Website
  • Popular Cyber Attacks
  • Preventative Measures
  • One Way Hash

  • 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

    PCmover - $15 Off with Coupon Code CJPH7Q

    Lock Down Your Website - Preventative Measures
    (Page 3 of 4 )

    If you are running (or planning to run) a PHP driven e-commerce store, you must account for the following security features:

    • An authentication system that allows users to log into your site
    • Routines that allow only properly authenticated users to access or update sensitive information
    • Data encryption to securely store highly sensitive information such as credit card numbers
    • Logging routines that record usage information to allow analysts to detect possibly malicious patterns of use
    • Monitoring software that alerts administrators to malicious behavior in real-time
    • Encrypted connections for transmitting sensitive information

    To begin with, never use the GET method for sending sensitive information, always use POST to enclose the information in the HTTP header rather that the URL query string. The POST method is not necessarily more secure; it just doesn't display the information for all to see. Using the GET method to send a username and password to the PHP engine would be like posting a $100 bill in a transparent envelope.

    In order to allow an authentication system, several things will need to be implemented: a form in which the user can register their username and password, and another form to sign into the site; a table in your database to store the usernames and associated passwords of users, and a secure way of storing this information; and PHP scripts that enter new information into the table and checks the table when a user tries to sign in.

    I won't go into the html side of things here, but a simple PHP script to enter a new username and password into the table could be as follows:

    <?php

    $host=" ";

    $uname= "root";

    $pass=" ";

    $database="nameofyourdatabase";

    $tablename="nameofyourtable";

    $connection= mysql_connect ($host, $uname, $pass)

    or die ("Database connection failed! <br> ");

    $result=mysql_select_db ($database)

    or die ("Database could not be selected");

    $query = "INSERT INTO nameofyourtable VALUES (' ".$customerid." ',' ".md5 ($password)." ') ";

    if (!$query)

    {

    die(" Query could not be executed.<br>");

    }

    ?>

    The above code checks that the password field is not empty and that the password and confirm password are the same. The information is then written to the table and the password is stored as an MD5 hash using the md5() function. You then also need a PHP script to check the username and password when visitors sign in. This type of hash is known as a one way hash and is useful as a way of storing passwords because you'll never need to know what the visitor's password is.

    More Security Articles
    More By Dan Wellman


     

       

    SECURITY ARTICLES

    - An Epilogue to Cryptography
    - A Sequel to Cryptography
    - An Introduction to Cryptography
    - Security Overview
    - Network Security Assessment
    - Firewalls
    - What’s behind the curtain? Part II
    - What’s behind the curtain? Part I
    - Vectors
    - PKI: Looking at the Risks
    - A Quick Look at Cross Site Scripting
    - PKI Architectures: How to Choose One
    - Trust, Access Control, and Rights for Web Se...
    - Basic Concepts of Web Services Security
    - Safeguarding the Identity and Integrity of X...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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