Add a member login to your website
Writing a php login script and adding a user login box to your website requires you to synchronise a html login form, user database, session cookies and a php script. For very experienced programmers it's all fairly bread and butter stuff, but for those people who deal more with design it can sometimes be a bit of an ordeal.
This tutorial will show you one easy way to add a login box to your website with minimal fuss using User Session Pro.
I'm going to assume that you've got yourself some web space that runs php, and you've installed User Session Pro. So, with that in mind let's begin.
First of all you need to create the html for your page and save it as a .php file.
Then just amend your file to include these two main bits of php as follows:
This bit goes in the top of your document, before anything else. It just sets up User Session Pro as per your control panel:
And this bit goes in the middle of your html where you want the login box to appear:
So your final document will look something like this (obviously you will have different HTML):
That's it. Any users you add using your control panel will be able to log in and out on any page of your website that includes those two snippets of code. You can edit the html for the login box in the admin panel, and either edit the css there, or move the css over to your main css file.
I know what you're thinking..."That's all well and good, but what use is that? Wont everyone be able to see all the same pages?"
Well, yes, you are right. To protect content or show different content to users or anonymous visitors check out the tutorial on how to protect site content
If you've got any questions and/or comments about the above tutorial, please do post them here using the form below...or if you prefer email me at info@prophpscripts.com