I’ve found this script (which I think others here might have used) but, I’m not sure how to implement this into a Freeway site.
In order to use it, the pages must be .php (the instructions say to just change .html to .php) and I’m not sure how or where to add the code needed to protect the page.
If anyone has any experience with this, I would appreciate it.
It seems fairy simple. How much do you or don’t you understand?
Basically, if you’ve folloed the instructions and put your password-prtect.php file on the site alongside your other files, you need to do two things.
rename the page your protecting to a .php extension - do this in the inspector.
add the markup … <?php include("/home/haveahobby/htdocs/protector/password_protect.php"); ?>… to the very start of your document. Do this through the Page - HTML Markup in Freeway and add this code in the ‘before HTML’ section
Save your file and upload it. make sure you have the script file on the server, too, and it should work.
You do need to ensure your paths are correct in the snippet you add to your page. They show a relative path, although maybe an absolute path would work, i don’t know, eg. http://www.yoursite.com/foldermaybe/protector.php
I just tried it and it was simplicity itself - worked for me first time.
IF…you put the password-protect.php script in amongst your other page files on the server, then all you need as the code at the top of the page is…<?php include("password-protect.php"); ?>
In fact I renamed password-protect.php to protect.php, so my include was a simple <?php include("protect.php"); ?>
But remember, this include code MUST be right at the start of the page, before any HTML code…ok?
If you go to protect.php you shouldn’t even get the username/password page…something wrong there.
However, got to:
www.yourwebsite/protect.php?help
and it will give you the code. Note the ‘?help’ suffix - you must add this to the address. The you get a few lines with a line of code which you can copy to add to your pages.
OK. I discovered I put the username and sample name in the example section rather than where it was supposed to go!!
So, I fixed that and re-uploaded the protect.php, added the code to the protected page, but now it goes right to the page without asking for a username and password.
Hugh, I hope you’re still listening, because I have one more question…
I can’t figure out how to customize the page with the login fields. I’d like to have that page look like the rest of the site, but haven’t been able to figure it out.
Here’s where they tell you how to do it:
But, I can’t figure it out. Not sure exactly what code I’m copying or what page it goes on, or, well…any of it!
I’ve posted in their forum, but it seems pretty dead over there.