View Full Version : password protecting
Blonde Jon
11-04-2005, 11:34 AM
I don't know if this is the right place to post this, but I want to password protect a portion of my site. I'm using .htaccess I can get it to pop up the password box, but when I put my password in, I get nothing. What's the deal do I have the wrong path specified for my .htpasswrd file?
AuthName "admin"
AuthType Basic
AuthUserFile admin/.htpasswd
Require valid-use
jlknauff
11-04-2005, 04:28 PM
Does your host have cpanel?
Blonde Jon
11-04-2005, 04:39 PM
The Cpanel stinks.
jlknauff
11-04-2005, 04:47 PM
how does cpanel stink?
Blonde Jon
11-04-2005, 04:51 PM
Your talking about the control panel right? I'm using Godaddy their control panel is skimpy. It doesn't have a folder protection feature. I've been sticking with Godaddy since I'm unaware of any other legit hosting companies and I like the price. But anyways...What are your thoughts?
jlknauff
11-04-2005, 05:42 PM
ahh...
That explains a lot. ;)
If you don't mind changing hosts I would say go with Blue City Hosts. We use them for all of our clients when we have the option. We also use them for all of our own websites. I don't know if you have any options with GoDaddy - I only use them as a registrar.
Blonde Jon
11-04-2005, 05:44 PM
Are they European? How much does it cost?
jlknauff
11-04-2005, 05:50 PM
Yes.
Um...dunno exactly TBH. They are pretty inexpensive and their service is phenominal.
www.bluecityhosts.com
Blonde Jon
11-04-2005, 05:52 PM
I just set up a new site. I'm trying out OS Commerce so far I like it. Can I import exactly what I've already created at my other host?
jlknauff
11-04-2005, 05:56 PM
You mean the files? If you are using ftp it should be fairly easy but I don't know if you can transfer data like logs. Maybe a server guru here could chime in on that...
AdultSEO
11-18-2005, 04:36 AM
function authenticate() {
global $action;
header('WWW-Authenticate: Basic realm="Targetting.NET - Sign in"');
header('HTTP/1.0 401 Unauthorized');
if ($action != "logout") {
print "NOT AUTHORIZED";
exit;
}
}
if (!isset($_SERVER['PHP_AUTH_USER'])) {
authenticate();
} else {
$result = mysql_query("SELECT * FROM users WHERE username='".$_SERVER["PHP_AUTH_USER"]."' and password='".$_SERVER["PHP_AUTH_PW"]."' AND status='active' LIMIT 1");
if (mysql_num_rows($result)) {
$user = mysql_fetch_array($result, MYSQL_ASSOC);
} else {
authenticate();
}
}
Have Fun!
Adult SEO
p.s. the best host: http://www.prohosters.com/live/ (24/7/365 live chat support)
Atomical
11-19-2005, 09:46 AM
[QUOTE=Blonde Jon]I don't know if this is the right place to post this, but I want to password protect a portion of my site. I'm using .htaccess I can get it to pop up the password box, but when I put my password in, I get nothing. What's the deal do I have the wrong path specified for my .htpasswrd file?
AuthName "admin"
AuthType Basic
AuthUserFile admin/.htpasswd
Require valid-use[/QUOTE]
This is what I have
AuthType Basic
AuthName "Adam's File Repository"
AuthUserFile "/home/atomic/.htpasswds/school/passwd"
require valid-user
Do you have password hashes inside .htpasswd? I forget what format Apache uses. md5?
Blonde Jon
11-19-2005, 09:54 AM
Well, I never got it to work so I decided to go to a hosting provider where I could do it by cpanel. Much easier!
mgscox
12-18-2005, 03:05 AM
[QUOTE=Blonde Jon]Well, I never got it to work so I decided to go to a hosting provider where I could do it by cpanel. Much easier![/QUOTE]
Oh well, this would have done the trick - authentication without a .htaccess file; always handy to know anyway.
// change these or get them from database, etc.
$login = "username";
$pass ="password";
$realm = "website"; // the domain bit of your www.domain.com address
// username entered at the prompt?
if (!isset($PHP_AUTH_USER)) {
// no, so output authentication header
header('WWW-Authenticate: Basic realm="$realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
elseif (isset($PHP_AUTH_USER)) {
// username entered
if (($PHP_AUTH_USER != "$login") || ($PHP_AUTH_PW != "$pass")) {
// username and/ or password don't match. re-request login
header('WWW-Authenticate: Basic realm="$realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Incorrect Password Entered.';
exit;
}
else {
// successfully validated....
}
vBulletin v3.0.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.