By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,899 Members | 1,085 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,899 IT Pros & Developers. It's quick & easy.

logging to a website and data is being stored in a text file using perl

P: 2
this is my perl script saved as login.pl
Expand|Select|Wrap|Line Numbers
  1. #!c:/perl/bin/perl.exe
  2. $basedir="c:/program files/apache software foundation/apache2.2/cgi-bin";
  3. $datafile="regstr.txt";
  4. $name=$in{'login'};
  5. $passwd=$in{'passwd'};
  6. open(FH1,"+>>regstr.txt");
  7. @input=<FH1>;
  8. print(@input);
  9. @input=($login,$password);
  10. close(FH1);
  11. print "Content-type: text/plain; charset=iso-8859-1\n\n";
  12. {
  13. chop();
  14. if($arr[1] eq $login)
  15. {
  16.  if($arr[3] eq $password)
  17.  {
  18.   print "<HTML>";
  19.   print "<HEAD>";
  20.   print "<SCRIPT>";
  21.   print "function back(form){history.back();}";
  22.   print "</SCRIPT>";
  23.   print "</HEAD>";
  24.   print "<BODY text=green>";
  25.   print "<BR><BR><BR>";
  26.   print "<CENTER><H1>Thanks your registeration is saved".$name."</H1><FORM><BR>";
  27.   print "<FORM>";
  28.   print "<BR><A HREF='http://10.199.44.116/cgi-bin/latest.html'></A><BR><BR>";
  29.   print "</FORM>";
  30.   print "</BODY>";
  31.   print "</HTML>";
  32.   flag=1;  
  33. }
  34. }
  35. }
  36. if($flag=!1)
  37. {
  38.   print "<HTML>";
  39.   print "<HEAD>";
  40.   print "<SCRIPT>";
  41.   print "<function home(form){history.back()}";
  42.   print "</SCRIPT>";
  43.   print "</HEAD>";
  44.   print "<BODY text=green>";
  45.   print "<BR><BR><BR>";
  46.   print "<H1><CENTER>Sorry your login and password does not exist.</H1><BR>";                
  47.   print "</FORM>";
  48.   print "</BODY>";
  49.   print "</HTML>"; 
  50. }
this is my html script saved as latest.html
[HTML]<HTML>
<HEAD>
<TITLE>Welcome to the website login page</TITLE>
<SCRIPT Language = "JavaScript">
function verify(form)
{
for(i = 0; i <= 3; i++)
{
if(document.forms[0].elements[i].value == "")
{
alert("Please Fill In Your " + document.forms[0].elements[i].name);
document.forms[0].elements[i].focus( );
return(false);
}
}
document.forms[0].submit();
}
</SCRIPT>
</HEAD>
<CENTER>
<TABLE Border = "4">
</TABLE>
<BR><BR><BR>
<FORM ACTION= "http://10.199.44.116/cgi-bin/login.pl" METHOD="POST">
<TABLE align=center border=5 cellPadding=5 cellSpacing=5 Size="800">
<TR>
<TD Colspan = "1" Width="40%">
<FONT Id = spl Color="Green" Size= "5">
<B>Login :</B>
</FONT>
</TD>
<TD>
<INPUT Name = "login" Size="35" Type = "Text">
</TD>
</TR>
<TR>
<TD Colspan = "1" Width="40%">
<FONT Id = spl Color="Green" Size="5">
<B>Password :</B>
</FONT>
</TD>
<TD>
<INPUT Name = "passwd" Size = "35" Type = "Password">
</TD>
</TR>
<TR>
<TD Colspan = "1" Width="40%">
<FONT Id = spl Color = "Green" Size= "5">
<B>Confirm Password :</B>
</FONT>
</TD>
<TD>
<INPUT Name = "confirm passwd" Size = "35" Type = "Password">
</TD>
</TR>
</TABLE>
<BR><BR>
<TABLE Align = "Center" Border = "0" Width = "40%">
<TR>
<TD Align = "Center" Width = "50%">
<INPUT Type = "Button" Value = "SUBMIT" onClick = "verify(this.form)">
</TD>
<TD Align = "Center" Width = "50%">
<INPUT Type = "Reset" Value = "RESET">
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</BODY>
</HTML>[/HTML]
Oct 4 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.