Miscellaneous
  Home arrow Miscellaneous arrow Page 3 - Writing a Basic Authentication System ...
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  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
JMSL Numerical Library 
IBM® developerWorks
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? 
MISCELLANEOUS

Writing a Basic Authentication System in PHP
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 10
    2004-12-24

    Table of Contents:
  • Writing a Basic Authentication System in PHP
  • Storing Passwords
  • Getting the User Login
  • Processing the Login
  • Persisting the Authentication
  • Conclusion

  • 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


    Writing a Basic Authentication System in PHP - Getting the User Login


    (Page 3 of 6 )

    An HTML form is used to obtain the user's login credentials. The form displays 2 input fields--one to obtain the login ID and another to obtain the password.

    <form action="validate.php" method="post">
      <label for="userid">ID</label>
      <input type="text" name="userid" id="userid" />
      <br />
      <label for="password">Password</label>
      <input type="password" name="password" id="password" />
      <br />
      <input type="submit" name="submit" value="Submit" />
    </form>

    The userid input field accepts the user's login id while the password field will accept the user's password. The password field might show asterisks or dots as the value is entered, but remember that the form will send it's data in clear text. A secure connection should be made using HTTPS. For more information on that subject see my tutorial Generating Your Own Security Certificates For Use With Apache/HTTPS.

    The form here submits its information to a script named validate.php as specified by the form's action attribute. It's that script that will be responsible for checking the user's login ID and password in the database and allowing the user to continue.

    More Miscellaneous Articles
    More By bluephoenix


       · 1. $user = $_POST[&quot;userid&quot;];NEVER trust a user input, and do...
       · Excellent tutorial Timothy!I was planning on writing an authentication system...
       · Excellent tutorial Timothy!I was planning on writing an authentication system...
       · I agree with your point, [below], but could you provide an example, I am not a...
       · Certainly never trust user input... and remember SQL queries are vulnerable to...
       · You're welcome :)-Tim
       · My comments has no direct relation with this usefull tutorial's contents. It is a...
       · If magic_quote_gpc is off this code is vulnurable to sql injections.See...
       · ...&gt;You'll notice I didn't get into those topics as it's a tutorial just...
       · quote:Re: Some Sad mistakes posted by bluephoenixDecember 28, 2004, 4:46...
       · 
       · Zulan, I understand the necessity for security as well as your concerns. Perhaps...
       · Just to clarify to anyone using this tutorial, it's brilliant, but beware!If you...
       · Great tutorial,but as a beginner I'm confused. How exactly would we insert sha1...
       · Great tutorial,but as a beginner I'm confused. How exactly would we insert sha1...
       · Great tutorial,but as a beginner I'm confused. How exactly would we insert sha1...
       · Thanks a bunch. The mistakes made are irrelevant; don't have to shove the whole...
     

    MISCELLANEOUS ARTICLES

    - Stopping CSRF Attacks in Your PHP Applicatio...
    - Quick and Dirty AJAX Tutorial
    - Flickr Puzzle Mashup
    - The PAVISE of Security
    - Creating a CAPTCHA with PHP
    - Sending SMS Thru HTTP
    - The Postal Fix - Part 2
    - Adding Mail with Exim
    - The Postal Fix - Part 1
    - Create Your Own Custom API
    - Adding Drop Shadows with PHP
    - Writing a Basic Authentication System in PHP
    - Overlapping Images with GD
    - Using Sockets in PHP
    - Dynamic CSS with PHP






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