![]() |
![]() |
#1 (permalink) |
Psycho
|
Password Protection
I want to password protect an area of a site and was wondering if there was a way of doing it without paying for an encryption program. I see that there are short little javascripts you can write, but these are supposedly easy to get around. Any suggestions?
|
![]() |
![]() |
#2 (permalink) |
Addict
|
I use php, it depends on the level of security your going after
you could try the following code, it's pretty standard. put it in a seperate file called authentication.php and put include('../authentication.php'); at the top of all pages you want pasword protected. put the following in php tags // This page handles the authentication for the admin pages. $authorized = FALSE; // Initialize a variable. // Check for authentication submission. if ( (isset($HTTP_SERVER_VARS['PHP_AUTH_USER']) AND isset($HTTP_SERVER_VARS['PHP_AUTH_PW'])) ) { if ( ($HTTP_SERVER_VARS['PHP_AUTH_USER'] == 'name') AND ($HTTP_SERVER_VARS['PHP_AUTH_PW'] == 'password') ) { // If the correct values were entered... $authorized = TRUE; } else { $authorized = FALSE; } } else { $authorized = FALSE; } // If they haven't been authorized, create the pop-up window. if ($authorized == FALSE) { header('WWW-Authenticate: Basic realm="Administration"'); exit(); // For cancellations. } |
![]() |
![]() |
#3 (permalink) |
Darth Papa
Location: Yonder
|
Neat hack, d*d. Of course, that PHP code is just simulating the web server's built-in authentication mechanism.
What server and platform are you using, sadatx? If it's Apache, then you can likely put a .htaccess file in the appropriate directory and configure password protection there. Do you have shell access to the server? |
![]() |
![]() |
#5 (permalink) |
Junkie
|
You probably don't need shell to use .htaccess (although it's a heck of a lot easier). You'll need to find out what platform Stargate is hosting your site on. If it's linux you can just create a .htaccess file and FTP it. They probably have some mechanism for you to work with permissions after you get it there or you can change permissions in some FTP clients. Be careful, if you don't know what you're doing you can mess things up pretty bad.
Read as much as you can about .htaccess. Your best bet is to contact Stargate or at least do a search for "permissions" or ".htaccess" on their site. They may not allow it. GoDaddy.com does allow it (if you're inclined to change hosts). You still need to figure out which platform you're on first. |
![]() |
Tags |
password, protection |
|
|