On Sat, 14 Jun 2003, ashish srivastava wrote:

> Hi Ibrahim
> Thanks for ur help !
> I am able to connect to the UNIX server using Prompt=>'/[\w]$-/' (the login
> being the user id with which the person has logged in eg. "tom-" ). But 1
> more prob.
> i have an application in which this perl script is being called by an HTML
> form (the usual Login screen ) and the login pwd is passed to the perl
> script
>
> This is my code for the HTML form
> ======================
> <html>
> <head>
>   <title>Login Screen</title>
> </head>
> <body>
> <H1><center><U> User Log in Screen </U></H1></center>
> <br><br><hr>
> <form name="usrlogin"
> action="/cgi-bin/telp.pl" method="GET" >
> <center>
> User id  : &nbsp&nbsp&nbsp
> <input type="text" name="fname" >
> <br>
> Password :
> <input type="password" name="fpwd" > <br><br>
> <input type="reset" Value="Reset" > &nbsp&nbsp  <input type="submit"
> Value="Submit" ><hr>
> </ center>
> </form>
>
> </body>
> </html>
>
> And this is the Perl code
> ================
>
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use Net::Telnet();
> print "Content-type:text/html\n\n";
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/,$buffer);
> print " @pairs \n";
> $j=0;
> foreach $pair (@pairs) {
>     ($name, $value) = split(/=/, $pair);
>     $value =~ tr/+/ /;
>       #($dummy,$name)= split(/?/,$name);
>     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>     $FORM{$name} = $value;
>       $info[$j]= $value;
>       $j++;
> }
>
>
> $t = new Net::Telnet (Timeout => 10, Prompt
> =>'/xxxx-/i',input_log=>'D:\server\logs\inputlog.txt');
>          $t->open("xxx.xxxx.xxx.xxx") or die "Server not found \n";
>         $t->login($usr, $pwd);
>               @lines = $t->cmd("ls -l");
>               foreach $temp(@lines)
>               {
>         print "<a href = \"cgi-bin/change_dir.pl\">$temp</a><br>";
>               }
>
> ==> The problem is that when i clik submit in the login screen, it dosent
> paas the usrname nad pswd to the perl prog. I dont understand why this is
> happening.
> Please help.
>

It's because you said the method was GET but you tried to retreive the
value from the form as though the method was POST. When the method is GET
the form values are passed via the $ENV{QUERY_STRING}. I strongly suggest
that the GET method NOT be used when you are passing a password unless you
only want to keep the password secret from those who don't know how to
view/source on an HTML page. Also why are you "hand-parsing" the form
input anyway when the CGI module has already done it for you?

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to