Password protect a web page (Full Version)

All Forums >> [Community] >> OutFront Discoveries



Message


womble -> Password protect a web page (2/2/2007 16:25:23)

Anyone who runs a forum knows just how irritating those damned spammers peddling their pharmaceutical goods and such like, and worse, can be. I seem to spend half my life clearing up after them. I'd looked at various options for trying to stop them, but the simplest I've found so far is this one - all it needs is one line of PHP added to the very top of the page you want protecting, and no-one can get to it without the password. I've applied it to my registration page - the password's available on the forum, so real human type people can find it, but not the bots (although I suppose you could use a simple question like on Mike Cherim's spam-proof form as well).

I tarted the password form page up a bit to add in the site's logo and a bit more of an explanation as to why the system had been introduced, but probably for most purposes you can use it as it is.

http://www.zubrag.com/scripts/password-protect.php

It's only been installed on this particular forum for about five hours now (but yay! no more spammers today! [sm=boogie.gif]), but we've used something similar on another forum I co-admin, and it cut our spammer problem down from 100+ per week to virtually zero overnight.

It can be used on any web page you want to protect, and you don't have to know PHP to use it. Uploading the file to your site and then opening the script page in your browser gives you the exact text you need to use for the 'include' line, for example, www.mydomain.com/password_protect.php. From the results of that page you simply paste that include into the very top of the page you want protecting, and once you've set the users (if you want to have different user accounts) and passwords in the script itself (you just open the script up in a text editor and edit as instructed in the script, and you're set - ideal if you want to protect certain pages but don't need an admin panel and bells and whistles.




treetopsranch -> RE: Password protect a web page (2/2/2007 23:37:56)

Not really sure you can use that script if you use FrontPage Extensions. I think it alters the .htaccess file. I noticed that a question was asked if it worked with Frontpage in their forum but I could not see any answer there. Can someone here test it for us FP extension users?




womble -> RE: Password protect a web page (2/3/2007 12:45:04)

AFAIK it doesn't alter the .htcaccess file - at least it's not mentioned in the script at all - if a cookie's not been set it brings up the include file with the form asking for the username and/or password, then if that matches what's in the settings in the script, redirects to the page you're protecting.

Eeep! That link's now opening some strange Russian language site that appears to be for hosting/co-location or something - most odd. Maybe they forgot to pay their hosting bill? [:D]It definitely wasn't doing that yesterday! If anyone's interested in the script though, drop me a PM and I'll email it.




jaybee -> RE: Password protect a web page (2/3/2007 13:01:33)

It says they've run out of bandwidth and it's all your fault. [:D]




womble -> RE: Password protect a web page (2/3/2007 13:18:41)

[sm=theyareontome.gif]




tinaalice -> RE: Password protect a web page (2/6/2007 11:30:48)

It's working now ..

Note: That one's pages MUST use the .php extension for this to work.

So ideal for php forums, blogs and that sort of thing. No doubt there is something similar for ASP.

Tina




Kitka -> RE: Password protect a web page (2/6/2007 19:00:52)

quote:

Note: That one's pages MUST use the .php extension for this to work.


Not quite true. You can simply add a handler to your .htaccess file so it will work with .htm and .html files as well.

AddHandler application/x-httpd-php .htm .html




tinaalice -> RE: Password protect a web page (2/6/2007 19:28:54)

I was going off what it said:) I know nothing about php.. perhaps someone should give them that info?

This is neat ... my control panel for pw is clunky and I usually end up spending twice a long figuring out how I did it last (the help file is nothing like the panel)... I need one to show a test web too so it happens.. kewl.

Tina




Thomas Brunt -> RE: Password protect a web page (2/7/2007 8:46:06)

Here's a bit of code you can put into your .htaccess file that will allow php code to work on .htm pages.

AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

t




treetopsranch -> RE: Password protect a web page (2/7/2007 14:42:38)

Still waiting for someone to test that script on a FrontPage Extension enabled web site.




womble -> RE: Password protect a web page (2/7/2007 15:50:57)

A while since I've used FP, but AFAIK, as long as you don't FTP, I wouldn't think it would affect the FPSEs.




Kitka -> RE: Password protect a web page (2/7/2007 16:58:00)

quote:

ORIGINAL: Thomas Brunt

Here's a bit of code you can put into your .htaccess file that will allow php code to work on .htm pages.

AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html


That is almost exactly what I said above - but my code is more compact [;)] [:D]




wisnuclear -> RE: Password protect a web page (2/9/2007 10:57:07)

Has anyone tried to protect a folder and it's contents?




Kitka -> RE: Password protect a web page (2/9/2007 14:39:07)

This tool should help you with that:

http://tools.dynamicdrive.com/password/

Or, if you want to use the FrontPage method, see this tutorial:

http://www.outfront.net/tutorials_02/fp_techniques/frontpage-subwebs.htm

There is a good step by step guide with screen shots here:

http://www.verio.com/support/documents/view_article.cfm?doc_id=3715




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.03125