read(STDIN, $buffer, $ENV{\"CONTENT_LENGTH\"});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(\"C\", hex($1))/eg;
$value =~ s///g;
$value=~ s/<([^>]|\\n)*>//g;
$value=~ s/>/>/g;
$value=~ s/
$FORM{$name} = $value;
}
print \"Content-type: text/html\\n\\n\";
print \"
print \"
\\n\";if ($FORM{\"PASS\"} eq \"\") $host= shift || \"\"; use DBI;
$|= 1; # Autoflush
$table=\"usedata\";
$dbh = DBI->connect(\"DBI:mysql:$test_db:$host\",$opt_user,$opt_password) || die \"Can\"t connect: $DBI::errstr\\n\";
$n1 = $FORM{\"IDNO\"};
$sth=$dbh->prepare(\"select * from usedata where userno=$n1 \") or die $dbh->errstr;
$sth->execute() or die $sth->errstr;
if (($row = $sth->fetchrow_arrayref)) $dbh->disconnect(); login.pl #!/usr/bin/perl read(STDIN, $buffer, $ENV{\"CONTENT_LENGTH\"}); print \"Content-type: text/html\\n\\n\";
print \" print \" if ($FORM{\"PASS\"} eq \"\") $host= shift || \"\"; $table=\"usedata\";
$dbh = DBI->connect(\"DBI:mysql:$test_db:$host\",$opt_user,$opt_password) || die \"Can\"t connect: $DBI::errstr\\n\";
$n1 = $FORM{\"IDNO\"}; $sth->execute() or die $sth->errstr;
if ($FORM{\"IDNO\"} eq \"\")
{
print<
返回前页修改
EOF
exit(0);
}
{
print<
返回前页修改
EOF
exit(0);
}
$test_db=\"test\";
$opt_user=$opt_password=\"\";
{
$dbh->disconnect();
print<
返回前页修改
EOF
exit(0);
}
$n2 = $FORM{\"PASS\"};
$n3 = 1;
$dbh->do(\"insert into $table values($n1, $n2,$n3)\") or die $DBI::errstr;
print<
EOF
exit(0);
# login.pl
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(\"C\", hex($1))/eg;
$value =~ s///g;
$value=~ s/<([^>]|\\n)*>//g;
$value=~ s/>/>/g;
$value=~ s/
$FORM{$name} = $value;
}
if ($FORM{\"IDNO\"} eq \"\")
{
print<
返回前页修改
EOF
exit(0);
}
{
print<
返回前页修改
EOF
exit(0);
}
$test_db=\"test\";
$opt_user=$opt_password=\"\";
use DBI;
$|= 1; # Autoflush
$sth=$dbh->prepare(\"select * from usedata where userno=$n1 \") or die $dbh->errstr;
if (($row = $sth->fetchrow_arrayref))
{
if ($row->[1] eq $FORM{\"PASS\"})
{
$NUM = $row->[2]+1;
$sth=$dbh->prepare(\"UPDATE usedata SET lognum=$NUM where userno=$n1 \") or die $dbh->errstr;
$sth->execute() or die $sth->errstr; print<
EOF
}
else
{
print<
返回前页修改
EOF
}
}
else
{
print<
返回前页修改
EOF
}
$dbh->disconnect();
print <
EOF
exit(0);