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.
Next: Building It Up >>
More PHP Articles
More By James Ruttan