For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > May 2005 > http auth logindialog box









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author http auth logindialog box
Nikos

2005-05-30, 3:57 am

Hello inside my games.pl script i want an http auth box to popup and ask
for login credentials.
Only if its correct then games.pl will load else an eroor message popup.

So i made this after searching on the net and modifying some code:

#==========================CHECKING USERS
CREDENTIALS===========================
my $browser = LWP::UserAgent->new;

$browser->credentials(
'www.nikolas.tk:80',
'Personal Folder',
'nikos' => 'nikos'
);

my $url = 'http://www.nikolas.tk/cgi-bin/games.pl';
my $response = $browser->get($url);


die "Error: ", $response->header('Nikos Personal Folder') || 'Error
accessing',
"\n ", $response->status_line, "\n at $url\n Aborting"
unless $response->is_success;

I dont know why, but a box an http auth box never appears so i can test
this by entering nikos and nikos.

Whats am i doing wrong?


--
What is now proved was once only imagined!
Tad McClellan

2005-05-30, 3:57 am

Nikos <hackeras@gmail.com> wrote:

> Hello inside my games.pl script i want an http auth box to popup and ask
> for login credentials.



Then configure your web server so that it will do that for you.

If you don't know how to configure your web server, ask in a
newsgroup about webservers.


> my $browser = LWP::UserAgent->new;



LWP is the _client_ side of a WWW client-server exchange, so you are
completly in left field trying to use it for your purpose above.

games.pl is the _server_ side of a WWW client-server exchange.


> Whats am i doing wrong?



Trying to do this without a proper mental model of how HTTP
and CGI work.


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Nikos

2005-05-30, 8:57 am

Tad McClellan wrote:
.....{snip]

Well have you encounter something relevant in the past?
Perhaps if you did, could you paste some code to see how am i supposed
to do what i want cause i am completely clueless.

I did it onw in PHP and was an easy atsk to do but in Perl although i
googled didnt come up with something.


--
What is now proved was once only imagined!
Tad McClellan

2005-05-30, 3:57 pm

Nikos <hackeras@gmail.com> wrote:
> Tad McClellan wrote:
> ....{snip]
>
> Well have you encounter something relevant



Relevant to what?

Please quote some context in followups like everybody else does.

And don't put in a attribution unless you are actually going
to quote something that goes with the attribution.


> in the past?



Maybe you meant relevant to getting auth for your CGI program?

Well, yes I have encountered something relevant, how the heck did
you think that I knew to point you toward looking at configuring
the web server?

Because it has happened to me before, and that is how I solved it.


> Perhaps if you did, could you paste some code



I could, but I won't.

I plan to studiously avoid helping you until your behavior improves.

You build your reputation, and then you live with the reputation
that you have built.


> to see how am i supposed
> to do what i want



Unlike you, I do *not* want to piss off everybody here by making
off-topic postings, so I wouldn't be explaining web server
configuration stuff in the Perl newsgroup anyway.


> cause i am completely clueless.



No you're not, I gave you one little clue and one big clue in
the part that you snipped above!

You are not merely "clueless", you are "clue resistant" to a most
astonishing degree.

The little clue was that you are looking for the answer in the wrong
place. In other words, you are looking for the keys only where the
streetlight shines.

Look for the answer in a newsgroup about the subject that you
need help with, such as:

comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix

The big clue was that you don't have the Big Picture of the domain
that you are attempting to program in.

You will waste a whole lot of time if you simply press on in ignorance
rather than stop and go find out how this stuff operates.


> I did it onw in PHP and was an easy atsk to do but in Perl although i
> googled didnt come up with something.



Were you googling in the right place to look or in the wrong place to look?


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Nikos

2005-05-30, 3:57 pm

Tad McClellan wrote:
> Nikos <hackeras@gmail.com> wrote:
>
>
>
>
> Relevant to what?
>
> Please quote some context in followups like everybody else does.
>
> And don't put in a attribution unless you are actually going
> to quote something that goes with the attribution.
>
>
>
>
>
>
> Maybe you meant relevant to getting auth for your CGI program?
>
> Well, yes I have encountered something relevant, how the heck did
> you think that I knew to point you toward looking at configuring
> the web server?
>
> Because it has happened to me before, and that is how I solved it.
>
>
>
>
>
>
> I could, but I won't.
>
> I plan to studiously avoid helping you until your behavior improves.
>
> You build your reputation, and then you live with the reputation
> that you have built.
>
>
>
>
>
>
> Unlike you, I do *not* want to piss off everybody here by making
> off-topic postings, so I wouldn't be explaining web server
> configuration stuff in the Perl newsgroup anyway.
>
>
>
>
>
>
> No you're not, I gave you one little clue and one big clue in
> the part that you snipped above!
>
> You are not merely "clueless", you are "clue resistant" to a most
> astonishing degree.
>
> The little clue was that you are looking for the answer in the wrong
> place. In other words, you are looking for the keys only where the
> streetlight shines.
>
> Look for the answer in a newsgroup about the subject that you
> need help with, such as:
>
> comp.infosystems.www.servers.mac
> comp.infosystems.www.servers.misc
> comp.infosystems.www.servers.ms-windows
> comp.infosystems.www.servers.unix
>
> The big clue was that you don't have the Big Picture of the domain
> that you are attempting to program in.
>
> You will waste a whole lot of time if you simply press on in ignorance
> rather than stop and go find out how this stuff operates.
>
>
>
>
>
>
> Were you googling in the right place to look or in the wrong place to look?
>
>

look man i have to get this going.
I have no problem reading something but i dont know what.
maybe the apache web server need some configuration but i understand
that not the proper place to ask that.

BUT, also some perl code is included and thats a perl questions and i
really could use a lot of help on that.

It looks simple but its a synthetic problem.

Iam on XP btw.

--
What is now proved was once only imagined!
A. Sinan Unur

2005-05-30, 3:57 pm

Nikos <hackeras@gmail.com> wrote in news:d7fi7i$22h$1@nic.grnet.gr:

> look man i have to get this going.


Your problem.

> It looks simple but its a synthetic problem.


Do you know the meanings of the words you use?

http://www.google.com/search?q=define%3A+synthetic

On the other hand, maybe it is appropriate. There was no problem, and you
created one.

You have just entered my "someone else's problem" field.

Tad has already pointed you in the right direction.

Sinan

--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/c...guidelines.html
Brian McCauley

2005-05-30, 3:57 pm

A. Sinan Unur wrote:

> Nikos <hackeras@gmail.com> wrote in news:d7fi7i$22h$1@nic.grnet.gr:
>
>
> Do you know the meanings of the words you use?


I thought he was saying it was homework. :-)
Brian McCauley

2005-05-30, 3:57 pm



Nikos wrote:

> Hello inside my games.pl script i want an http auth box to popup and ask
> for login credentials.
> Only if its correct then games.pl will load else an eroor message popup.


I think you are very very about the relationship between HTTP
clients, HTTP servers and your Perl script.

By what mechanism is your Perl script being invoked? What is it
intended to do?

> my $browser = LWP::UserAgent->new;


LWP is a (non-interactive) web client written in Perl. Do you want your
script to act _as_ an HTTP client?

> I dont know why, but a box an http auth box never appears so i can test
> this by entering nikos and nikos.


What are you expecting to lauch this dialogue box? Usually it would be
launched by an interactive web browser but there's no such web broswer
in the situation you describe.
Brian Wakem

2005-05-30, 8:57 pm

Nikos wrote:

> Hello inside my games.pl script i want an http auth box to popup and ask
> for login credentials.
> Only if its correct then games.pl will load else an eroor message popup.
>
> So i made this after searching on the net and modifying some code:
>
> #==========================CHECKING USERS
> CREDENTIALS===========================
> my $browser = LWP::UserAgent->new;
>
> $browser->credentials(
> 'www.nikolas.tk:80',
> 'Personal Folder',
> 'nikos' => 'nikos'
> );
>
> my $url = 'http://www.nikolas.tk/cgi-bin/games.pl';
> my $response = $browser->get($url);
>
>
> die "Error: ", $response->header('Nikos Personal Folder') || 'Error
> accessing',
> "\n ", $response->status_line, "\n at $url\n Aborting"
> unless $response->is_success;
>
> I dont know why, but a box an http auth box never appears so i can test
> this by entering nikos and nikos.
>
> Whats am i doing wrong?
>
>



You are clearly very and your problem is nothing to do with Perl.

I suggest you go to google and look up htaccess and htpasswd. Also read
http://httpd.apache.org/docs-2.0/howto/htaccess.html, but do not ask
question about it here - it is OT.


--
Brian Wakem

Nikos

2005-05-31, 4:01 pm

Brian Wakem wrote:

> You are clearly very and your problem is nothing to do with Perl.
>
> I suggest you go to google and look up htaccess and htpasswd. Also read
> http://httpd.apache.org/docs-2.0/howto/htaccess.html, but do not ask
> question about it here - it is OT.


ok i have read and made the .htaccess and .passwd files fro http
authentication purpsoses

What happens when the user enter the correct data and what happens if he
doesnt?

Now i think Perl has to take control.

if credentials are correct then games.pl would run else an error page.

How i can do this with perl?


--
What is now proved was once only imagined!
Brian Wakem

2005-05-31, 4:01 pm

Nikos wrote:
> Brian Wakem wrote:
>
>
>
> ok i have read and made the .htaccess and .passwd files fro http
> authentication purpsoses
>
> What happens when the user enter the correct data and what happens if he
> doesnt?
>
> Now i think Perl has to take control.



No. The webserver has control here.


> if credentials are correct then games.pl would run else an error page.



The webserver does this for you if you have configured it correctly (I
have pointed you towards the docs).



--
Brian Wakem


Tad McClellan

2005-05-31, 4:01 pm

Nikos <hackeras@gmail.com> wrote:
> Brian Wakem wrote:
>
>
> ok i have read and made the .htaccess and .passwd files fro http
> authentication purpsoses
>
> What happens when the user enter the correct data and what happens if he
> doesnt?



The same thing that would happen if your program was written
in Java or Python or Visual Basic.

You've been asked to not ask questions about web server configuration here.

Why are you asking questions about web server configuration here then?

Do you *intend* to piss everybody off, or do you claim it is accidental?


> Now i think Perl has to take control.



Then you are still very .

Perl does not "take" control. It is not in charge of servicing the request.

The web server is in charge of controlling the request, it *calls*
your Perl program if authentication has succeeded.


> if credentials are correct then games.pl would run else an error page.



So which one happened when you tried it then?

Did games.pl run? (if so, then why is it that you are here again?)

Did you get an error page? (if so, then ask about what the message says in
some newsgroup that is related to WWW stuff)


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com