in reply to Re^2: INSERT file contents inside a table
in thread INSERT file contents inside a table

See perldata  $#days  # the last index of array @days

while (<DATA>){ chomp; next unless /\S/; # skip blank lines my @f = split /[ ,]+/; my $n = $#f; my $date = join ' ',@f[0..2]; my $recip = join ' , ',@f[5..$n-1]; my $id = $f[$n]; # last col my $color = ($f[3] eq 'INFECTED') ? '#ffcccc' : '#ffffff'; $table .= qq!<tr style="font-family:courier" bgcolor="$color"> <td>$date</td> <td>$f[3]</td> <td>$f[4]</td> <td>$recip</td> <td>$id</td> </tr>!; $table .= "</tr>"; }
poj

Replies are listed 'Best First'.
Re^4: INSERT file contents inside a table
by theravadamonk (Scribe) on Jun 04, 2018 at 09:38 UTC

    Thank You very much. It work as expected. Sorry for the delay since I was very busy.

Re^4: INSERT file contents inside a table
by theravadamonk (Scribe) on Jun 06, 2018 at 11:04 UTC

    Hi Poj,

    Sorry for disturbing u. May I ask another question?

    I want to release the quarantined mail right there. I Just want to add a link to release the quarantined mail. If u have a better way, You may suggest.

    I just added below stuffs to the code. But It does NOT work.

    <td><a href=/cgi-bin/release.pl>$id</a></td>

    This release.pl works separately. But with the link I added, It does NOT work. Below is the way to release it.

    #system("sudo /usr/bin/amavisd-release spam-KvefDigP-2QR.gz system("sudo /usr/bin/amavisd-release $id

    I think this below code has a mistake somewhere. IF I can get it solved it's the easiest way. Anyway, If I click the link, It SHOULD ask an question "Are You sure to release it with YES and NO option?

    <td><a href=/cgi-bin/release.pl>$id</a></td>

    Your Ideas r welcome to solve it.

      release.pl works separately.

      Show the release.pl code that works

      I just added below stuffs to the code.But It does NOT work.

      What is the error shown in the web server log ?

      poj

        Hi, thnaks for your reply. I am doing it with a front end html code.

        Here's my front end html code. it's release.html

        <html> <head> <title>Release your email</title> </head> <body bgcolor="#95B8DB" onload="parent.adjustMyFrameHeight();"> <form action="/cgi-bin/release.pl" method="post"> <h1>Release your email</h1> <div style="height:500px; dispaly:block;">Pls input the Mail ID: <inpu +t name="release" size="20" style="height:30px"> <input type="submit" +value="Release" style="height:30px"></div> </form> </body> </html>

        Here's the release.pl code. It works. Remember I still am a Novice. Pls don't blame my perl code. I don't feel shy. Everyone learns little by little. any way, This code works.

        #!/usr/bin/perl use CGI qw(:standard); $ENV{"PATH"} = "/usr/sbin:/usr/bin:/sbin:/bin"; $release = param('release') || '<i>(No input)</i>'; print "Content-type: text/html\n\n"; print "<body bgcolor=\"#95B8DB\">"; print "<h1>You are releasing: $release</h1>"; system("/bin/echo > /tmp/releaseme"); system("sudo /bin/chmod 777 /tmp/releaseme"); system("sudo /usr/bin/amavisd-release $release 2> /tmp/releaseme"); if (system("less /tmp/releaseme |grep Ok > /dev/null") == 0) { print "<h2>Your Mail ID $release was released.\n</h2>"; print "<br />"; } else { print "<h2>Error!!! Wrong Mail ID, Pls Input the Right Mail ID +.\n</h2>"; print "<br />"; } print "</body>";

        Anyway, I had to change the code since it gave an error due to below line in that release.pl code

        $release = param('release') || '<i>(No input)</i>';

        I changed it in this way. Pls see the below release.pl code. THIS IS the code I now use. But does NOT work

        #!/usr/bin/perl use CGI qw(:standard); $ENV{"PATH"} = "/usr/sbin:/usr/bin:/sbin:/bin"; #$release = param('release') || '<i>(No input)</i>'; print "Content-type: text/html\n\n"; print "<body bgcolor=\"#95B8DB\">"; #print "<h1>You are releasing: $release</h1>"; print "<h1>You are releasing: $id</h1>"; system("/bin/echo > /tmp/releaseme"); system("sudo /bin/chmod 777 /tmp/releaseme"); system("sudo /usr/bin/amavisd-release $id 2> /tmp/releaseme"); if (system("less /tmp/releaseme |grep Ok > /dev/null") == 0) { print "<h2>Your Mail ID $id was released.\n</h2>"; print "<br />"; } else { print "<h2>Error!!! Wrong Mail ID, Pls Input the Right Mail ID +.\n</h2>"; print "<br />"; } print "</body>";

        Many thanks for your reply. Your INPUTS r welcome. Thanks a lot