Gossamer Forum
Home : General : Perl Programming :

What does this mean?

Quote Reply
What does this mean?
H. Could someone please tell me why the following code give me an error (at the bottom of this post);

Code:
if ($cobalt ne "") { $print_cobalt = "AuthPAM_enabled off"; } else { $print_cobalt = ""; }

open(HTACCESS, ">$root/.htaccess") || die &error("Unable to create .htaccess file. Reason : $!");
print HTACCESS "AuthName \"MEMBER ONLY\" \n";
print HTACCESS "AuthType Basic \n";
print HTACCESS "AuthUserFile $root/.htpasswd \n";
print HTACCESS "$print_cobalt \n";
print HTACCESS "require valid-user \n";
close(HTACCESS) || die &error("Unable to close the .htaccess file. Reason: $!");

open(HTPASSWD, ">$root/.htpasswd") || die &error("Unable to create .htpasswd file. Reason : $!");
print HTPASSWD "$admin_username:$crypted_admin_password\n";
close(HTPASSWD) || die &error("Unable to close the .htpasswd file. Reason: $!");

AuthName takes one argument, The authentication realm (e.g. "Members Only")



Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: What does this mean? In reply to
Remove all that escaping and new lines and use:

my $htaccess = qq|
AuthUserFile $root/.htpasswd
AuthName 'MEMBER ONLY'
AuthType Basic
<LIMIT>
require valid-user
</LIMIT>
|;

In the open statement use:

print HTACCESS $htaccess;

Forget all that cobalt junk, it isn't needed.

There are tons of htaccess tutorials on the web, please take the time to read some.

Quote Reply
Re: What does this mean? In reply to
Actually Paul, I think you will find the cobalt bit is needed Wink People that run my old version of my script on Cobalt servers said that the alert box would appear, but the username and password would not get accepted! Adding that line DID sort it :)

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: What does this mean? In reply to
Well er....talking from experience I know that it isn't needed on a lot of RAQs


Quote Reply
Re: What does this mean? In reply to
Infact it can CAUSE 500 errors.


Quote Reply
Re: What does this mean? In reply to
I should hope you do know, considering you run a Cobalt server Wink

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: What does this mean? In reply to
Precisely......so why were you disputing my comment.....lol

So in conclusion...if I were to use your script and it said

"Do you use a RAQ?"

.......I'd obviously tick yes and then low and behold I'd get a 500 error.


Quote Reply
Re: What does this mean? In reply to
Yes, that is why there is a help option next to it, so they can read about it first! Wink

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!