Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

lakeTrout's scratchpad

by lakeTrout (Scribe)
on Dec 31, 2004 at 06:45 UTC ( [id://418478]=scratchpad: print w/replies, xml ) Need Help??

Here's almost the ENTIRE delete script that pertains to this question
#!/usr/bin/perl use CGI qw(:standard); #faster, more legible use CGI::Carp qw(fatalsToBrowser); #Paths $path = "/just/my/path/here/"; $Date = `date`;chop $Date; ######################### $mailProgram = '/usr/lib/sendmail -t -eq'; $recipient = "me\@here.com"; # . $FORM{manageremail}; ######################### Files $logfile = "tempfile_ext.tmp"; $logfileOrig = "logfile_ext.log"; chmod 777, $logfile; chmod 777, $logfileOrig; $message = "<b>Thank you for your edit.</b> <p> <a href=admin.html>Bac +k to Admin Screen</a>"; $message2 = "<b>Thank you for your submission.</b> <p> <a href=index.h +tml>Back to Home</a>"; # Get the input from the form read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); ## Un-webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%0D%0A/<br>/g; $value =~ s/%09//g; $value =~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; ## Grammartize checkbox values if ($value eq "on") { $value = $name; } $FORM{$name} = $value; } my $linenumber = $FORM{linenumber}; #print OUTFILE "Param check $linenumber"; my $currentline = 0; # Program Logic &makelog; &thankyou; &mailMessage; &mailMessage2; # Program Logic done, just subroutines now. # Print an HTML page with variable data. sub thankyou { if ($linenumber){ print "Content-Type: text/html\n\n"; open(THANKS, "thanks.html") || die "thanks.html: $!"; while (<THANKS>) { s/%message%/$message/g; print $_; } close(THANKS); } else { print "Content-Type: text/html\n\n"; open(THANKS, "thanks.html") || die "thanks.html: $!"; while (<THANKS>) { s/%message%/$message2/g; print $_; } close(THANKS); } } # Append form data to tab delimited log file. sub makelog { #copy existing logfile to tempfile, while skipping edited record open (LOGFILE, ">$logfile") or die("Can't Open Log File at $logfil +e"); open (ORIG, "<$logfileOrig") or die("Can't Open Log File at $logfi +leOrig"); while (my $origLine = <ORIG>) { $currentline ++; print LOGFILE $origLine unless $currentline == $linenumber; } close (ORIG); close (LOGFILE); rename $logfile, $logfileOrig if $linenumber; } #Send message to recipient open (MAIL, "|$mailProgram -t $recipient") || die "Can't open $mailpro +gram!\n"; print MAIL ("From: $FORM{owner_email}\n"); print MAIL ("$message\n"); close (MAIL); #Here's how I generate the mail message - primitive, but works sub mailMessage { $message = <<"EOS"; SUBJECT: External Bulletin Title: $FORM{bulletin_title} Bulletin Summary: $FORM{bulletin_summary} EOS } # Send message to submitter open (MAIL, "|$mailProgram -t $FORM{owner_email}") || die "Can't open +$mailprogram!\n"; print MAIL ("From: XXXXXXXX\n"); print MAIL ("$message2\n"); close (MAIL); sub mailMessage2 { $message2 = <<"EOS"; SUBJECT: External Submission Confirmation Thank you stuff..... EOS }
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-24 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found