Jump to content

Cpanel's Password Protect


Recommended Posts

If you set up a web protect subdirectory in cpanel and link to a page in that subdirectory, a login box will appear. Some people get it, some don't depending on their browser settings.


Ok.. Having a brain spasm..... How to put a login box directly into a webpage that takes you to the protected sub so the popup is not needed. Have done it once, on a site I worked on a while back but can not for the life of me remember how now.....


And if anyone finds my purple pen, let me know...I left that somewhere too. Can't remember where.



Link to comment
Share on other sites

Why thank you both for finding and engraving the pen. How lovely.

I have to say that it gave me quite a chuckle to see the pen had traveled so far!:)


As it turns out, I was remembering wrong earlier today. I had done a login box for a password protected page, but it was not for the web protect feature. It was part of another script before I found web protect in cpanel.


I like the more secure option of the cpanel web protection, but have been asked to provide a login box without a popup. Is that possible?



Link to comment
Share on other sites

Sorry Lisa, but the page you link to (www.scripts.com/javascript-scripts/form-scripts/htaccess-login-box) links to another page (www.hostroute.com/resources/index.html) where the script is supposed to be which it doesn´t. :)


Hostroute.com´s scripts seems to be:

javascript VAT Calculator #1 - adds VAT to an order total.

javascript VAT Calculator #2 - works out the VAT content of a gross total.

SSI IP address capture - how to capture your visitors IP address and display it in a form.

Edited by TCH-Thomas
Link to comment
Share on other sites

Ok. Using Lisa's search criteria (I had been looking for password login, and other variations) I did come across this script, but can't seem to get it to access our "web protect" passworded directory. Is the script now defunct due to newer technology, or am I just missing something in the implementation?





2 part script:


PART 1: Place in head


<script LANGUAGE="JavaScript">


<!-- Based on FTP log in by:  Reinout Verkerk -->

<!-- Original:  Gordon Hudson (sales at hostroute.com) -->

<!-- Web Site: http://www.hostroute.com/ -->

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->


<!-- Begin

function Login(form) {

var username = form.username.value;

var password = form.password.value;

var server = form.server.value;

if (username && password && server) {

var htsite = "http://" + username + ":" + password + "@" + server;

window.location = htsite;


else {

alert("Please enter your username and password.");



//  End -->




PART 2:  placed where you want the input fields to be:


<!-- The hidden form field "server" needs to be the

     address of your password protected directory. -->


<form name=login>

<input type="hidden" name="server" value="www.domain.com/subdirectory/">


<input type=text name=username size=20>



<input type=password name=password size=20>

<input type=button value="Login!" onClick="Login(this.form)" name="button">


Link to comment
Share on other sites

On the line:

><input type="hidden" name="server" value="www.domain.com/subdirectory/">

you changed domain.com/subdirectory with the address of the protected directory right?

Since this is javascript and not all people have javascript enabled in their browsers (e.g. myself) this still might not work for everyone.

Link to comment
Share on other sites

Found a second script, a PHP script.


But it seems both have become useless! Take a look at this post from another discussion board....

This capability http://username:password@domainname.com was disabled in Internet Explorer in February of this year. As users of IE incorporate the IE security patches, any site using this method will break. Frankly, it ticks me off. It was good usability tool that's been turned off because of vulnerabilities in IE and scammers using this format to hide URLs in emails and on websites. Blame the phishers and other scammers on the Net, but also blame MS for having in insecure system.



Well, I guess the popup box will have to do unless someone else has a better suggestion!



Link to comment
Share on other sites


This script allows you to use a login box on your web page, to login to an htaccess protected directory, instead of the usual htaccess popup. It can be used for any htaccess protected directory. May also be used as a CPanel login box. No database required, only PHP4. Now fixed for the new IE update



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...