Apr 09
Easy setup of Login, Registration and Password Protected areas on your website

This video tutorial will walk you through setting up a registration and login system for your web pages. You can then password protect any pages you desire on your website.
The script allows a user to register, log in, log out, change their password, and retrieve a forgotten password. It also makes sure the user submits a valid email address by sending them a link to their email that they must click before the registration is completed.
There is no need to know coding the video will walk you through setting it all up. All the files you need are available for download on this site.
The script for this tutorial comes from the book Visual Quickpro Guide PHP 6 and MYSQL 5. I highly recommend this book if you want to learn php.
- User Registration
- Log in
- Log out
- User can change password
- User can retrieve forgotten password
- Password protect any pages on your site with a small snippet of code
- Of course it’s free
- Overview
- Demo
- Download
A free registration and login system for your website.
Watch the video to the left for step by step instructions on Getting set up.
A recommended book on learning PHP
PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide
If you’re interested in knowing more about php I recommend you pick up this book today.
Easy Web Hosting $6.95 - Bluehost - Hands down the best in web hosting. You really couldn’t ask for a better webhost in terms of price and features. I’ve tried others and will only use bluehost now. They blow the competition way out of the water.

April 18th, 2008 at 1:27 pm
It doesn’t work on php 4.x. Needs a lot of tweaking to run, so I’m still working on it. Anyway, it looks nice. Thanks for your work.
April 21st, 2008 at 10:14 pm
great tutorial! thanks!
April 27th, 2008 at 10:13 am
hi,
I have a problem when I try to insert login.php and index.php into my website.
If I leave the two files as you made them, the login system works perfectly, but I’m trying to insert their code into the pages of my site (for keeping an uniform “style”).
I created my login.php and index.php with Dreamweaver; then I copied the php code contained in your login.php and index.php and put in mine. But there’s something wrong, perhaps because some php code is also contained in footer.html and header.html.
Can you make an example to integrate this code in new formatted pages?
thanks and sorry for my bad english
April 28th, 2008 at 3:30 am
Hi!
This has been a great tutorial, and I really appreciate how well you’ve shared your information… I have tried to install this on my site and am having a couple of problems. First, when I upload the pages and run my first test trying to find the login/index.php, I get this message:
Fatal error: Call to undefined function: date_default_timezone_set() in /homepages/14/d210788481/htdocs/login2/login/includes/config.inc.php on line 27
The first time I tried to set up this password protected area, I just edited my includes/config.inc.php page and deleted the parameter “Adjust the time zone for PHP 5.1 and greater… ”
***Is there something else I should do instead of deleting that definition?
Also, after eliminating that perameter, the index page worked (but didn’t pull up the footer.html include), and when I tested the registration, it seemed to take the information but never sent me an e-mail to confirm.
***Any suggestions?
THanks so much for your help!!!
Cyndi
May 3rd, 2008 at 12:07 am
yahoo
May 12th, 2008 at 7:26 pm
Amazing tutorial. Had my registration page up almost immediately.
One question: can someone tell me how to customize the activation email? Is there a way to make it an include file or insert some HTML into the area where the activation email will be?
Thanks,
Matthew
May 14th, 2008 at 4:59 pm
hi
this is really a great tut…
i want to know how to create the database, in the video u said that u have a tut in this site that shows
how to do it, but i couldnt find it. Can u plz send me the link about that tutorial…
thnx
May 14th, 2008 at 10:47 pm
I go through setting up a database in a few other tutorials on the site.
It’s the same process you would use to create a database for this script.
You can find these tutorials at these links.
http://www.easykiss123.com/?p=24
http://www.easykiss123.com/?p=26
May 18th, 2008 at 4:12 am
Never MIND am GOOD to goo no prob AT ALL
I DONT KNOW WHY I THINKG I HAVE TWO DOMAIN ONE MAIN ONE SUB SO WHAT I DID I PUT BOTH DOMain that login folder tht work great
thans to easy 123 great work
May 21st, 2008 at 12:17 am
When I click on the register button……..the next screen is BLANK.
There is NO confirmation that an email has been sent.
Please advise.
Thanks
May 21st, 2008 at 4:43 am
yo MR eaykiss 123
hoq u doing man i am lookig somthing like if some one upload pic to my upload folder and i wana that person see same time after upload done , i think u undeer stand wat am taking about can u put something like that Tutorial plz or can u help me out for that where am gona find code for that plz thanks
May 21st, 2008 at 2:49 pm
I had my copy re-configured based on your installation guide and worked well.
I had the control panel 100% mobilized which I have tested everything this morning and it ran well. But I had to delete the later upload due to changes i need to make in the index.php particularly to the contents (blah blah blah area). Then I have re-upload everything. However, as I tried to test it again, and posted my (example) new registration, I cannot receive the registration confirmation link to a third party (yahoo) email I have given. I checked all possible folder to receive the email (including spam folder) but there was none. I have also checked the database and found out that the email address I have given during the initial registration IS PRESENTLY STORED in the DBase.
Please advise how to correct this problem. Thanks!
May 21st, 2008 at 3:05 pm
DEVELOPMENT: I have then tried requesting for a new password reset (forget_password.php) and I happen to receive a new password reached the email address I have given. The question now is how could I receive email for the New Password BUT NOT receiving email for the Registration?
I hope to hear from you. Thanks.
May 21st, 2008 at 3:09 pm
DEVELOPMENT: After I receive the new password, I tried to sign-in again but it says that
“Either the email address and password entered do not match those on file or you have not yet activated your account”. This probably due to the reason that I have not yet validated/confirm yet my email address/initial registration.
So the question still the same, why am I not receiving a confirmation email but I can receive a password reset email?
Thanks.
Login
May 21st, 2008 at 3:31 pm
DEVELOPMENT: I registered from another email address and finally received confirmation. After confirming, I was able to log-in without any problem. I was expecting to be at the secured-page area but I have not seen anything except the WELCOME note. But my question in this particular is how am I going to be re-directed to the secured/password protected pages? Wish to receive your response. Thanks.
May 24th, 2008 at 7:16 am
Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in D:\Program Files\wamp\www\includes\config.inc.php on line 55
A system error occurred. We apologize for the inconvenience.
what the problem with this, error any can help me! plsssssssssssssss
May 27th, 2008 at 3:36 pm
To redirect the user to a specific page.
1. index.php around line 40 put the path to redirect to on that line
ORIGINAL
$url = BASE_URL . ‘index.php’; // Define the URL:
MIGHT CHANGE IT TO SOMETHING LIKE THIS
$url = BASE_URL . ‘protected_page.php’; // Define the URL:
2. I highly recommend watching the part two of the tutorials to see the changes made to the config script with the BASE_URL as well. It might help clarify things a little more and provide more flexibility.
May 28th, 2008 at 5:20 am
Great tutorial! It work wonderfully. I do have one question . . . after login, how long before you must login in again? When I go to the site, login and then leave and go somewhere else and then go back I’m getting right on without having to long in again. Is there a cookie, or what?
Anyway, thanks for the tutorial and information. It’s very helpful.
May 29th, 2008 at 5:57 pm
Fantastic, This has been my first hassle free implementation of a PHP registration system. My server uses Perl 5 and SQL 5 and it all worked exactly as you described. I am so chuffed. Thankyou.
June 1st, 2008 at 10:01 am
You said you would make a tutorial about this about the admin or something, Have you made it???? If so Can you please post a link??
Your tutorials are 100%
Jay
June 2nd, 2008 at 1:39 am
I’m having the same issues as two people above have identified.
First, the error “Fatal error: Call to undefined function: date_default_timezone_set() in /homepages/14/d210788481/htdocs/login2/login/includes/config.inc.php on line 27″ occurred. I resolved this by simply commenting out this line of the code.
Then, as is also described above, after registering the next screen is blank and no confirmation email is sent. Then, upon trying to login the screen following is also blank.
Any ideas on how to correct this error and get the script functional?
June 7th, 2008 at 9:33 pm
i set up this login page and it says: Fatal error: Call to undefined function: date_default_timezone_set() in /home/betfixed/public_html/login/includes/config.inc.php on line 27 ,what should i do now?
June 12th, 2008 at 12:23 am
Loved the tutorial, but it seems only to work for php5+. Any ideas on how to may it work for lesser versions. As after registration it goes blank and no confirmation email is left. Seems a view of us are having this problem. Keep up the good work.
June 13th, 2008 at 7:47 am
[…] Easy Setup of Login, Registration and Password Protected Areas on Your Website - This PHP tutorial covers exactly what the title says. The script created will allow a user to register, log in and out, change their password, and retrieve a forgotten password. […]
June 20th, 2008 at 7:32 pm
thanks ,,,, thanks a lot ,,,really work nice !!!!
very good tutorial.
June 22nd, 2008 at 6:37 am
is there a way to set up a system like this if i do not have access to sql since its free hosting.
June 25th, 2008 at 2:20 pm
Is there any way to rig your solution to enforce activation?
I don’t want immediate access after registration.
I would like to allow an admin to come in and give permissions.
Thanks
Evan Cutler
June 28th, 2008 at 9:09 am
I fixed my BLANK register and login problem when I submit information. My php was not compiled with mysqli (notice the ‘i’ at the end), so I just recompiled with –with-mysqli=/webserver/mysql/bin/mysql_config
Also I did fix the emailing Issue by using XPM4-v.0.5 which successfully sends it though and also passes the filter like what gmail has.
To contact me go to http://koodough.com/Web/miniContact.html
June 28th, 2008 at 4:30 pm
Everything is working on my site except for the the password protect page i keep getting this error
Warning: require_once(login/includes/config.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/liquidcr/public_html/web/lp/home.php on line 2
Fatal error: require_once() [function.require]: Failed opening required ‘login/includes/config.inc.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/liquidcr/public_html/web/lp/home.php on line 2
can you help?
July 1st, 2008 at 1:04 pm
Great program - so easy to use. Worked like a charm and was a breeze to install, even for a non-techie like me. Thank you so much.
July 18th, 2008 at 7:45 am
nevermind, i figured out my error… on my ‘mysqli_connect’ file i had the username entered in wrong.
it works now, thanks.
few other questions though, now that i got it working…
1) Is there a way to make it so the word CONTROL PANEL is indside that gray bar? I tried editing the header tag in the style.css file, but i couldnt figure out the right thing to change to get it to go inside the bar.
2) Is there a way for me to see a list of people who have registered? and if so, does it hide that list from other people (i dont want everybody knowing who is registered, i want to be the only one).
3)Can/How easily can this code be hacked by someone?
GREAT JOB ON THE TUTORIAL. It was definately very helpful. Thank you very much.
July 19th, 2008 at 7:57 am
Amazing, just wonderfull!
Still, ive got a problem with the validation mail. Everything works fine, it just doesnt send the validation mail.
What can i do to solve this problem?
July 22nd, 2008 at 6:56 pm
Nice tutorial , really helpful. Just wondering is there a way i can activate users without having to activate it through email.I just want to manualy input every user. I tried checking “null” in phpadmin for the activation colunm but im not sure if this is the proper way to do this. It seems like its not working.
Thanks.
July 23rd, 2008 at 10:05 pm
I have been getting a couple of emails and trying to help out with blank pages but unfortunately their remote server has MYSQL 4.1 or lower and didn’t or wouldn’t support MYSQLi. So I decided to create a MYSQL version with also XPM4-v.0.5 which successfully sends filtered-free emails. The code is rarely touched. I pretty much just remove the ‘i’s and added XPM4-v.0.5 . Also I added notes to the ‘install instructions.txt’ for SMTP
DOWNLOAD PAGE: http://web.mac.com/koodough/linux/Blog/Entries/2008/7/23_EasyKiss123_Login_-_MySQL_style.html
MySQLi ‘i’= improved
http://www.johnjawed.com/benchmarks/
Overview of ext/mysqli: http://forge.mysql.com/wiki/Converting_to_MySQLi
Like to hear some feedback
July 24th, 2008 at 11:25 am
Everything works, but activations lead to missing pages. I registered one account, after that,
registering no longer works.
August 1st, 2008 at 2:23 pm
Having problems with the blank page after register is clicked. I assume it’s the configuration for mysqli. I’m lost on if it’s the actually files I need to change or the phpadmin tool I need to reconfig. Any thoughts or help is appreciated?
Thanks,
August 1st, 2008 at 2:24 pm
Oh… I forgot I’m using godaddy.com and they have mysql and phpadmin built in.
——————————————————————————————–
Having problems with the blank page after register is clicked. I assume it’s the configuration for mysqli. I’m lost on if it’s the actually files I need to change or the phpadmin tool I need to reconfig. Any thoughts or help is appreciated?
Thanks,
August 12th, 2008 at 11:57 am
Great tutorial! It look wonderful but still didn’t understand where i have to copy the “create User table” — still at very first step… pls help as i used FTP programme and it took me to hosting directory
August 15th, 2008 at 12:49 am
this for easykiss123.
how can one do this a registaration page but at the same time make it so it for a paysite as well trying to introgate,your login registration page into something like a registration for a paysite i am trying to develop.i had half the login done then messed up so starting from scatch again ok thanks love the video was great especially for me no very little about php and html. thanks again.
admin100
August 20th, 2008 at 1:38 pm
I used php that is supplied by yahoo hosting. i think it is 2.3. So maybe that is why I can’t get anything to appear. All pages appear blank.
August 29th, 2008 at 6:27 pm
NIce work, I like the template, I got it work on my localhost but I try to get it onto my paid host it doesn’t work. I still try to tweak but seem to not work, please help, i think its not compatible with html/php 4.0, please hit me up with some tweaking lines; wsu2002@gmail.com thanks