Results 1 to 3 of 3

Thread: Run perl script in html

  1. #1
    Join Date
    Jul 2007
    Location
    Beranang
    Posts
    38
    Rep Power
    0

    Question Run perl script in html

    i'm trying to run a perl script that suppost to grab email input from html page on my CentOS 5 machine. But it doesn't seem to run.
    Here's the perl code
    Code:
    #! /usr/bin/perl
    
    # Simple Form Parser
    # Nothing Special :)
    #
    # 2008 - Mike Golvach - eggi@comcast.net
    #
    # Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
    #
    
    print "Content-type: text/html\n\n";
    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;
        $form{$name} = $value;
    }
    
    chop($today=`date '+%m/%d/%Y'`);
    $email_file_name = ">>/home/umarzuki/Desktop/emails.txt";
    open (EMAILFILE,$email_file_name);
    print EMAILFILE $today,"",$form{'email'},"","\n";
    close(EMAILFILE);
    
    $html_dir="/directory/where/your/thank/you/html/page/is";
    $fname = "$html_dir/thanks_for_your_submission.html";
    
    open (OFILE,$fname) ;
    while(<OFILE>) {
        s/##(\w+)#/$form{$1}/g;
        print $_;
    }
    close(OFILE);
    Hare's the html code
    Code:
    </d>
    <title>XYZ - TEMPORARY SITE MAINTENANCE</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    </head>
    <body bgcolor="003366">
    <!-- 2008 - Mike Golvach - eggi@comcast.net -->
    <!-- Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License -->
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr valign="top">
       <td rowspan="2" height="47" width="15%">
    <p>&nbsp;</p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
    
        <td width="5%">&nbsp;</td>
              <td width="5%">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td width="5%">&nbsp;</td>
              <td width="5%">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
    
            <tr>
              <td width="5%">&nbsp;</td>
              <td width="5%">&nbsp;</td>
              <td>&nbsp;
            </tr>
            <tr>
              <td width="5%">&nbsp;</td>
              <td width="5%">&nbsp;</td>
              <td>&nbsp;</td>
    
            <tr>
              <td width="5%">&nbsp; </td>
              <td width="5%">&nbsp;</td>
              <td>&nbsp; </td>
            </tr>
          </table>
     <td width="1%" height="51" >&nbsp;</td>
     <td width="79%" height="51">
    
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
       <td width="2%">&nbsp;</td>
              <td width="98%">
                <table border="0" cellspacing="0" cellpadding="0" width="545">
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
    
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
    </td>
       </tr>
    
      <td bgcolor="#FFFFFF" width="2%">&nbsp;</td>
              <td width="97%" bgcolor="#FFFFFF" valign=bottom>&nbsp;</td>
       </tr>
       <tr>
          <td bgcolor="#FFFFFF" width="2%">&nbsp;</td>
          <td width="97%" bgcolor="#FFFFFF" height="22" valign="top">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="92%" valign="top" height="1">&nbsp;</td>
    
            <td width="8%" height="1">&nbsp;</td>
        </tr>
             <tr>
                    <td valign="top">
    <p>We regret that our site is down for temporary maintenance. As soon as our work is complete the site will be available immediately. We apologize for the inconvenience!</p>
    <p>Please enter your email address and we will contact you as soon as our site becomes available!</p><p>&nbsp;</p>
    <form ACTION="cgi-bin/formparser.pl" METHOD="POST">
    <table border="0" width="100%">
    <tr>
    <td align="right" width="30%"><font size="2" FACE="arial, helvetica, geneva"><b>E-mail Address:</b></font><br><font size="1" FACE="arial, helvetica, geneva">(e.g. bobby.joe@host.com)</font></td>
    
    <td align="left" width="40%">&nbsp;<input NAME="email" TYPE="TEXT" SIZE="30"></td>
    <td width="30%" valign="middle" align="left"><font FACE="arial, helvetica, geneva" SIZE="2"><input NAME="name1" TYPE="submit" VALUE="Notify Me When The Site Is Back!"></font></td>
    </tr>
    </table>
    </form>
    </td>
                <td width="13%">&nbsp;</td>
             </tr>
        <tr>
            <td width="92%" valign="top" height="1">&nbsp;</td>
            <td width="8%" height="1">&nbsp;</td>
        </tr>
    
          </table>
          </td>
       </tr>
       <tr>
          <td bgcolor="#FFFFFF" width="2%">&nbsp;</td>
          <td width="97%" bgcolor="#FFFFFF" height="22" valign="top" align="center">&nbsp;</td>
       </tr>
       <tr>
          <td bgcolor="#FFFFFF" width="2%">&nbsp;</td>
    
          <td width="97%" bgcolor="#FFFFFF" height="22">&nbsp;</td>
       </tr>
          </table>
        </td>
      </tr>
    </table>
    </body>
    </html>
    What should I do? I already chown'd it to apache user
    Code:
    -rw-r--r-- 1 apache apache  895 Sep 23 11:19 formparser.pl
    ..and I referred to page The Linux and Unix Menagerie: Collecting Emails On Your Site Maintenance Page
    and The Linux and Unix Menagerie: Backend Processing Emails Submitted During Maintenance
    Last edited by umarzuki; 23-09-2008 at 12:18 PM. Reason: addendum

  2. #2
    Join Date
    Jul 2007
    Location
    Beranang
    Posts
    38
    Rep Power
    0
    Here's snippet of my httpd.conf
    Code:
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    
    <Directory "/var/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
    and I did put the perl script in /var/www/cgi-bin

  3. #3
    Join Date
    Jul 2007
    Location
    Beranang
    Posts
    38
    Rep Power
    0
    solved, I chmod to 755 the perl script.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Matrimonial Script with new feature, shaadi.com clone script
    By sahil101 in forum Website Programming
    Replies: 1
    Last Post: 14-10-2009, 01:23 PM
  2. How To Convert Shell Script to Batch Script
    By nana86 in forum Website Programming
    Replies: 0
    Last Post: 20-07-2007, 10:04 AM
  3. How to install cgi/perl script
    By air_master in forum Website Programming
    Replies: 2
    Last Post: 05-04-2007, 08:48 AM
  4. Apa beza perl dgn php ?
    By myravens in forum Website Programming
    Replies: 12
    Last Post: 05-04-2007, 05:11 AM
  5. cgi/perl with Tripod
    By masterryzz in forum Website Programming
    Replies: 0
    Last Post: 25-06-2005, 11:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37