2004-10-14, 05:26
  #1
Medlem
sandra_ns avatar
jag har ett cgi sendmailform där besökaren kan skriva in ett litet meddelande..
men när man har gjort detta så kommer man till en sida som tackar.. jag vill inte ha den! jag vill ha min egna, som är i samma layout.

så nu till min fråga hur kan jag vidaresända detta till en .htm fil? har testat att byta ändra lite här och var... men det har bara blivigt fel.

någon som kan hjälpa?
låt säga att sidan som skall länkast till är TEST.HTM

jag har klipt ut det jag tror är viktigt...
så här ser fösta delen ut

# Return HTML Page or Redirect User
&return_html;


och här är själva sidan jag inte vill ha som skall länkas vidare till min...

sub return_html {
# Local variables used in this subroutine initialized. #
local($key,$sort_order,$sorted_field);

# Now that we have finished using form values for any e-mail related #
# reasons, we will convert all of the form fields and config values #
# to remove any cross-site scripting security holes. #
local($field);
foreach $field (keys %Config) {
$safeConfig{$field} = &clean_html($Config{$field});
}

foreach $field (keys %Form) {
$Form{$field} = &clean_html($Form{$field});
}


# If redirect option is used, print the redirectional location header. #
if ($Config{'redirect'}) {
print "Location: $safeConfig{'redirect'}\n\n";
}

# Otherwise, begin printing the response page. #
else {

# Print HTTP header and opening HTML tags. #
print "Content-type: text/html\n\n";
print "<html>\n <head>\n";

# Print out title of page #
if ($Config{'title'}) { print "<title>$safeConfig{'title'}</title>\n" }
else { print "<title>Thank You</title>\n" }

print " </head>\n <body";

# Get Body Tag Attributes #
&body_attributes;

# Close Body Tag #
print ">\n <center>\n";

# Print custom or generic title. #
if ($Config{'title'}) { print "<h1>$safeConfig{'title'}</h1>\n" }
else { print "<h1>Thank You For Filling Out This Form</h1>\n" }

print "</center>\n";

print "Below is what you submitted to $safeConfig{'recipient'} on ";
print "$date<p><hr size=1 width=75\%><p>\n";

# If a sort order is specified, sort the form fields based on that. #
if ($Config{'sort'} =~ /^order:.*,.*/) {

# Set the temporary $sort_order variable to the sorting order, #
# remove extraneous line breaks and spaces, remove the order: #
# directive and split the sort fields into an array. #
$sort_order = $Config{'sort'};
$sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$sort_order =~ s/(\s+)?\n+(\s+)?//g;
$sort_order =~ s/order://;
@sorted_fields = split(/,/, $sort_order);

# For each sorted field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $sorted_field (@sorted_fields) {
local $sfname = &clean_html($sorted_field);

if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') {
print "<b>$sfname:</b> $Form{$sorted_field}<p>\n";
}
}
}

# Otherwise, use the order the fields were sent, or alphabetic. #
else {

# Sort alphabetically if requested.
if ($Config{'sort'} eq 'alphabetic') {
@Field_Order = sort @Field_Order;
}

# For each form field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $field (@Field_Order) {
local $fname = &clean_html($field);

if ($Config{'print_blank_fields'} || $Form{$field} ne '') {
print "<b>$fname:</b> $Form{$field}<p>\n";
}
}
}

print "<p><hr size=1 width=75%><p>\n";

# Check for a Return Link and print one if found. #
if ($Config{'return_link_url'} && $Config{'return_link_title'}) {
print "<ul>\n";
print "<li><a href=\"$safeConfig{'return_link_url'}\">$safeConfi g{'return_link_title'}</a>\n";
print "</ul>\n";
}

# Print the page footer. #
print <<"(END HTML FOOTER)";

</body>
</html>
(END HTML FOOTER)
}
}
Citera
2004-10-14, 05:35
  #2
Medlem
sandra_ns avatar
jag tar den andra också! nu när jag ändå håller på.. det är samma sak med detta cgi-scriptet (länkas till en .htm sida)

men detta är ett fil uploadingscript...

klipper ut en del som jag tror är den rätta... (+ lite till )




$body = "<body BACKGROUND=\"$background\" bgcolor=\"$bgcolor\" text=\"$text\" link=\"$link\" vlink=\"$vlink\">";

$html_header3="Uppladdad av:";

$EmailMessage = "New files have been uploaded!"; #email message

$numfiles++;

# Check Referring URL
&check_url();

use CGI;

$onnum = 1;
while ($onnum != $numfiles) {
my $req = new CGI;
if ($req->param("FILE1") eq "") { &error_nofile; }
my $file = $req->param("FILE$onnum");
if ($file ne "") {
my $fileName = $file;
$fileName =~ s!^.*(\\|\/)!!;
$newmain = $fileName;

$persname = $req->param("persname");
$persemail = $req->param("persemail");
$descr = $req->param("descr");


### Validate File Types ###

$filegood = "yes";
if ($allowall ne "yes") { &check_filetypes; }


### Do the Work ###

if ($filegood eq "yes") {

open (OUTFILE, ">$imagedir/$fileName");

#print "<tr><td>File $onnum: $fileName</td></tr>";
#if ($EMail eq "yes") { print MAIL "$newmain\n\n"; }
#if ($log ne "") { push(@filelist,"$fileName"); }
push(@filelist,"$fileName");
$temp = "File $onnum: $fileName";
push(@filelist2,"$temp");

while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
}
}
$onnum++;
}


if ($EMail eq "yes") { &send_mail_3; }
if ($log ne "") { &log_3; }
&print_html;

exit;

## Start of SubRoutines ##

################################################## #############
sub send_mail_3 {

#$upload2 = join(", ",@filelist);

# Open and write Confirmation Email

open(MAIL,"|$sendmail -t");

print MAIL "To: $ConfirmToEmail\n";
print MAIL "From: $ConfirmToEmail\n";
print MAIL "Subject: $SubjectEmail\n\n\n" ;
print MAIL "$EmailMessage\n\n";
print MAIL "\n";

foreach $i (@filelist2) {print MAIL "$i\n\n";}

print MAIL "\n";
print MAIL "Files uploaded by: $persname <$persemail>\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "Comments: $descr\n";
print MAIL "\n\n\n";
print MAIL "This CGI was developed by:\n\n";
print MAIL "Marek\'s Script Archive http://MareksScripts.w2w.cc\n\n";
close (MAIL);

}


################################################## #############
sub redirect {

print "Location:$donepage\n\n";

#exit;

}


################################################## #############
sub print_html {

print "Content-type:text/html\n\n";
print "<HTML><HEAD><TITLE>$html_title</TITLE></HEAD>\n";
print "$body\n";
print "<center><BR><h2>$html_header</h2></center>\n";
print "<center><BR><h4>$html_header2</h4></center>\n";
print "<center><table border=0 cellpadding=0 cellspacing=0 width=>\n";
print "<tr><td align=left>\n";
print "<center><table border=2 cellpadding=10 cellspacing=2 width=>\n";

foreach $i (@filelist2) {print "<tr><td>$i</td></tr>\n";}

print "</table></center><BR>\n";
print "<center><BR><h4>$html_header3</h4></center>\n";

print "<HR><table border=0 cellpadding=10 cellspacing=2 width=80%>\n";
print "<tr><td valign=top>\n";
print "Namn:</td><td width=50>$persname";
print "</td></tr></table>\n";

print "<table border=0 cellpadding=10 cellspacing=2 width=80%>\n";
print "<tr><td valign=top>\n";
print "Mail:</td><td>$persemail";
print "</td></tr></table>\n";
print "</td></tr></table>\n";

print "<table border=2 cellpadding=10 cellspacing=2>\n";
print "<tr><td align=center valign=top>\n";
print "Beskrivning:</td></tr><tr><td align=center width=300>$descr";
print "</td></tr></table>\n";

#print "</td></tr></table>\n";

print "<BR></center></body></html>";

#exit;
}
Citera
2004-10-14, 12:27
  #3
Medlem
*SNOR TRÅDEN*
ngn som vet var man kan hitta såna här färdiggjorda script?
med diverse funktioner;


// peakk
Citera

Skapa ett konto eller logga in för att kommentera

Du måste vara medlem för att kunna kommentera

Skapa ett konto

Det är enkelt att registrera ett nytt konto

Bli medlem

Logga in

Har du redan ett konto? Logga in här

Logga in