vil ik gå ind på den korrekte side....
Jeg har et html doc som har flg.:// --></script>
</HEAD>
<BODY BGCOLOR=\"#FFFFCC\" link=\"#003300\">
<FORM NAME=\"Test\" ACTION=\"http://www.domæne.dk/cgi-bin/nextpage.pl\" METHOD=\"POST\">
<INPUT TYPE=\"hidden\" NAME=\"PDCPDCNextPage\" VALUE=\"side002.htm\">
<B><FONT COLOR=\"#003300\"><A NAME=\"Q1\">1</A>. </FONT></B>
<FONT SIZE=\"+1\" COLOR=\"#003300\">Ønsker du at spring til spørgsmål 5?</FONT><P>
<BLOCKQUOTE><INPUT TYPE=\"radio\" NAME=\"Q1\" value=\"1\" onClick=\"document.forms[0].elements[0].value=\'side004.htm\';\"> ja
<BR>
<INPUT TYPE=\"radio\" NAME=\"Q1\" value=\"2\" onClick=\"document.forms[0].elements[0].value=\'side002.htm\';\"> nej
<BR>
</BLOCKQUOTE><P>
<FONT SIZE=\"+1\" COLOR=\"#003300\">Please click the Next button to continue the survey.<BR></FONT><INPUT TYPE=\"submit\" VALUE=\"Next\">
<INPUT TYPE=\"hidden\" NAME=\"PDCPDCProjectID\" VALUE=\"Wilke Undersøgelse\">
<INPUT TYPE=\"hidden\" NAME=\"PDCPDCAppVer\" VALUE=\"3.00.61\">
........osv osv
Den henviser til en .pl fil som hedder nextpage.pl og den ser ud som flg.:
http://www.domæne.dk/cgi-bin/nextpage.pl?PDCPDCNEXTPAGE=foo.htm&dept=sales&country=us&empcat=7
use CGI;
# Define standard HTML header
#
{
my $_HTTP_HDR_PRINTED = 0;
sub HTTPHEADER {
$_HTTP_HDR_PRINTED++ ? \'\' : \"Content-type: text/html\\r\\n\\r\\n\"
}
}
eval{
# get the form data.
my $html = new CGI();
# Do server side validation of form values
#if (-e \"survval.pl\") {
# require \"survval.pl\";
# Sur_Validate($html);
#};
# Get the name of the next page and perform some security checks
my $next_page = next_page_name($html);
# Read in the next page
my $file = file_read($next_page);
# Make the necessary replacements in the next page
my $output = expand_placeholders($html, $file);
# Output the new page
print HTTPHEADER . $output;
};
if ($@) {
print HTTPHEADER, <<\"EOD\";
<HTML>
<BODY BGCOLOR=\"#FFFFFF\">
We\'re sorry, but an error occurred in trying to process your script.
<!-- $@ -->
</BODY>
</HTML>
EOD
}
exit(0);
sub next_page_name{
my $cgi = shift;
# get the NextPage value
my $next_page = ($cgi->param(\'PDCPDCNextPage\'));
# make sure a cracker can\'t try to view another page by deleting any directory references
$next_page =~ s|/||g;
$next_page =~ s/\\\\//g;
$next_page =~ s/://g;
$next_page =~ s/\\.\\.//g;
# for good measure, don\'t let them see .pl, .cgi or .asp scripts either
$next_page =~ s/.asp//g;
$next_page =~ s/.cgi//g;
$next_page =~ s/.pl//g;
return $next_page;
};
sub expand_placeholders {
my $cgi = shift;
# >change variable names to be less like CGI-Perl Cookbook
local($template) = @_;
local($line, $line_copy, $changes);
# Initialize our variables
$line = $template;
$line_copy = \'\';
$changes = 0;
# Search for variables in the current line
while ($line =~ /{{([^}]+)}}/) {
# Build up the new line with the section of $line prior to the
# variable and the value for $var_name (check
# %frmdat, then %ENV for match)
++$changes;
if ($cgi->param($1)) {
$line_copy .= $` . $cgi->param($1) }
elsif ($ENV{$1}) {
$line_copy .= $` . $ENV{$1} }
else {
--$changes;
$line_copy .= $`;
}
# Change $line to the section of $line after the variable
$line = $\';
}
# Set $line according to whether or not any matches were found
$line = $line_copy ? $line_copy . $line : $line;
# Replace {} with <> for HTML tags
$_ = $line;
# Print line depending on presence of 0: and variables existing
return $_;
}
sub file_read{
local($input) = @_;
local($line,$output);
if (!open(INPUT, $input)) {
print HTTPHEADER, \"<HTML><HEAD><TITLE>Perl Script Requires File</TITLE></HEAD><H1>Perl Script Requires File</H1><BODY>Error opening file $input.</BODY></HTML>\";
return 0;
}
while ($line=<INPUT>) {
$output .= $line;
}
close INPUT;
return $output;
}
Mit spørgsmål går så på om der er nogle som kan se fejlen...for det kan jeg ikke....
