PHP
  Home arrow PHP arrow PHP for Beginners by a Beginner: Simple Lo...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
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? 
PHP

PHP for Beginners by a Beginner: Simple Login, Logout, and Session Handling
By: James Ruttan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 313
    2003-02-09

    Table of Contents:
  • PHP for Beginners by a Beginner: Simple Login, Logout, and Session Handling
  • Building It Up
  • Breaking It Down
  • Moving It Around
  • 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


    PHP for Beginners by a Beginner: Simple Login, Logout, and Session Handling


    (Page 1 of 5 )

    In this article, James presents a very simple way to add login/logout security in PHP using session handling.First off, let me say that, yes, I am still a beginner with PHP. Throughout the course of learning PHP though, whenever I’m stuck I like to go online to some of the chat rooms and ask for help.

    I have found, though, that the reputation of ‘computer geeks’, as parodied on Saturday Night Live, is well deserved by a lot of people. Asking for help from them was like asking them to let you borrow that authentic Klingon uniform they have in the display case down there with them in their parents’ basement (can you feel the love?). While I did find some help (after a lot of persistence), one thing I noticed with myself and with other novices was that the help came in a form as if we were on their level of programming, or we were met with a mass of arrogance and condescension, so, myself, I would still have to spend a couple of hours finding tutorials and articles here at DevArticles.com. But, I still had to have some things explained to me, which was a whole new task in itself.

    As I’ve grown a little more with my skills in PHP though, I’ve also begun offering help to other beginners with what knowledge I have and can share. One of the biggest problems I always get asked about is how to protect an area with a login and with sessions. I do not claim that this method is the strongest or the most secure, but that it is a simple solution to a beginner’s problem.

    One of my own preferences as a beginner when writing code is to use an editor, and one that is able to check the syntax as I have written it and return any errors. My own personal preference is one I have found to be a very good and inexpensive one. Ankord’s PHP Expert Editor , is, for me, a decent editor, and it only costs $35 to buy. You can also download a 30 day trial version from their site to try first. (No, I’m not affiliated with the company, I just like the product.) For it to check for syntax errors, you need to download and install the latest version of PHP.

    This editor is just my own personal preference; you may have your own or prefer not to use one, and I make no claims regarding your own experience with this editor.

    After trying a few different methods for simple form-based user authentication, I have found this method the least troublesome, especially when I wanted to add more to the authentication, such as simple access logging, but we will not be able to go into that here. This article does assume that you have some basic knowledge of PHP and HTML, but I hope that I have explained it in a way that any beginner can follow. I just wanted to share my knowledge of PHP that I have gained so far with other beginners, and would like to keep sharing it as I continue to progress.

    More PHP Articles
    More By James Ruttan


       · Hi James,a very clear and well-described article, thankyou. I have looked at...
       · It can be so hard to find a true "beginners" tutorial, but this explains it all very...
       · Hello there,I've been trying to use your tutorial and first it seemed excellent....
       · ok, I've checked these through and after reading it over and over again I found out...
       · You have to use $_REQUEST['username'] and $_REQUEST['password'] at the top of the...
       · very good and usefull article, but you could have included some reasons if your...
       · I've seen too many retarded login tutorials today, and I have to say, yours is the...
       · I am one of those coders who prefers to be able to doublecheck things for myself....
       · Well spotted chaps... a little oversight by James, but nonetheless a very good...
       · I was searching for a Login code for my Website when i stopped by this page.The...
       · As we are putting while($rows=mysql_fetch_array($result))then why do we need to...
       · Excellent tutorial in general. As already mentioned though the code in login.php is...
       · Well, I had plenty of errors with this script.To start it off.DROP TABLE IF...
       · Hi i've found the article very usefull.Just wanted to know, what do i have to do if...
       · Hi. I found your article useful and informative. Thanks for posting it.I am...
       · I've used the login feature of phpbb3 to start sessions and check logins before...
       · The login htm works fine and if a field is left blank page remains the same. But...
     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek