$ENV{'CONTENT_LENGTH'};

I have an applet using URLConnection to send data from a Client Browser to a Server.
I can read the values passed using Perl but i want to use PHP.
Perl example:
read STDIN, $buffer,$ENV{'CONTENT_LENGTH'};
does anyone know that the PHP equivalent to this?
thanks.

Hi,
But the server doesn't need to know that the client is in Java. The protocol is http, so your question is only related to php.
/Kaj

Similar Messages

  • Form won't submit, newbie, probably being an idiot

    Probbally being an absolute idiot as completely new to web design, but really stuck, all help hugely appreciated...
    form on http://www.refuseboredom.com/EasterHolidays.html, form is validating itself but doesnt post??
    its supposed to be going to a FormMail.pl which is in the base directory, hosting with godaddy who accept perl scripts and say the script can be put anywhere on the server,
    Don't know what i'm missing!!
    Form Code:
    <div id ="form" >
          <form action="FormMail.pl" method="post" name="form1" target="_top" id="bookingform">
         <input type=hidden name="redirect" value="http://www.refuseboredom.com/thankyou.html" />
         <h2>BOOK HERE</h2>
         <input type=hidden name="recipient" value="[email protected]">
           <div>
            <span id="sprytextfield1">
            <label for="FirstName">Parent/Guardian First Name:</label>
            <input type="text" name="FirstName" id="FirstName" tabindex="1" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
            </div>
    <span id="sprytextfield2">
    <label for="LastName">Parent/Guardian Surname:</label>
    <input type="text" name="LastName" id="LastName" tabindex="2" />
    <span class="textfieldRequiredMsg">A value is required.</span></span>
         <div>
          <span id="sprytextfield3">
          <label for="Address1">Address 1st line:</label>
          <input type="text" name="Address1" id="Address1" tabindex="3" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          </div>
          <div>
          <span id="sprytextfield4">
          <label for="Address2">Address 2nd Line:</label>
          <input type="text" name="Address2" id="Address2" tabindex="4" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          </div>
          <div>
          <span id="sprytextfield5">
          <label for="City">City: </label>
          <input type="text" name="City" id="City" tabindex="5" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          </div>
          <div>
          <span id="sprytextfield6">
          <label for="Postcode">Postcode:</label>
          <input type="text" name="Postcode" id="Postcode" tabindex="6" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          </div>
          <div>
          <span id="sprytextfield7">
          <label for="Phone">Prefered Contact number:</label>
          <input type="text" name="Phone" id="Phone" tabindex="7" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          </div>
          <div>
          <span id="sprytextfield8">
          <label for="Email">Email Address</label>
          <input type="text" name="Email" id="Email" tabindex="8" />
          <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg">Not a Valid E-mail Address</span></span>
          </div>
          <div id="select1">
          <label for="Quantity"> Number of children you would like to book for:</label>
          <select name="Quantity" id="Quantity" tabindex="9" class="Quantity" >
            <option>1</option>
            <option>2</option>
            <option>3</option>
          </select>
          </div>
          <div id="Child1Div">
          <span id="sprytextfield9">
          <label for="Child1">Child's Name:</label>
          <input type="text" name="Child1" id="Child1" tabindex="10" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          <span id="spryselect2">
          <label for="Child1Age">Child's Age:</label>
          <select name="Child1Age" id="Child1Age" tabindex="11">
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
          </select>
          <span class="selectRequiredMsg">Please select an item.</span></span>
          </div>
      <div id="Child2Div">
        <span id="sprytextfield10">
          <label for="child2">Child's name:</label>
          <input type="text" name="child2" id="child2" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          <span id="spryselect3">
          <label for="Child2Age">Child's Age:</label>
          <select name="Child2Age" id="Child2Age">
          <option>10</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
          </select>
          <span class="selectRequiredMsg">Please select an item.</span></span>
    </div>
       <div id="Child3Div">
          <span id="sprytextfield11">
          <label for="Child3">Child's Name:</label>
          <input type="text" name="Child3" id="Child3" />
          <span class="textfieldRequiredMsg">A value is required.</span></span>
          <span id="spryselect4">
          <label for="Child3Age">Child's Age:</label>
          <select name="Child3Age" id="Child3Age">
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
          </select>
          <span class="selectRequiredMsg">Please select an item.</span></span>
        </div>
        <div>
          <span id="spryselect5">
          <label for="Type">Holiday Dates:</label>
          <select name="Type" id="Type" tabindex="12">
            <option value="Easter2week">2 Week Easter Holiday: April 2nd -  April 13th</option>
            <option value="April2nd1week">First Week: April 2nd - April 6th</option>
            <option value="April9th1week">Second Week: April 9th - April 13th</option>
            <option value="Easterspecial">Easter Special: 2 weeks</option>
          </select>
          <span class="selectRequiredMsg">Please select an item.</span></span>
              </div>
          <div id="Notes">
          <label for="Notes">Please use this area to let us know of any special requirements including medical and dietary needs that we may need to be aware of, if your child is applying with a friend please let us know here as well so we can try and make sure their on the same team: </label><br />
          <textarea name="Notes" id="Notes" cols="45" rows="5" tabindex="13"></textarea>
          </div>
          <input name="submit"  type="submit" id="submit" tabindex="14" value="Book Now" />
          </form>
          </div>
    FormMail.pl Code:
    #!/usr/bin/perl
    # FormMail                        Version 1.93                               #
    # Copyright 1995-2009 Matt Wright [email protected]                    #
    # Created 1995-06-09              Last Modified 2009-07-14                   #
    # Matt's Script Archive, Inc.:    http://www.scriptarchive.com/              #
    # COPYRIGHT NOTICE                                                           #
    # Copyright 1995-2009 Matthew M. Wright  All Rights Reserved.                #
    # FormMail may be used and modified free of charge by anyone so long as this #
    # copyright notice and the comments above remain intact.  By using this      #
    # code you agree to indemnify Matthew M. Wright from any liability that      #
    # might arise from its use.                                                  #
    # Selling the code for this program without prior written consent is         #
    # expressly forbidden.  In other words, please ask first before you try and  #
    # make money off of my program.                                              #
    # Obtain permission before redistributing this software over the Internet or #
    # in any other medium. In all cases copyright and header must remain intact. #
    # ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
    # XSS + REDIRECT FIX: Francesco Ongaro, Giovanni Pellerano & Antonio Parata  #
    #   v1.93             http://www.ush.it/team/ush/hack-formmail_192/adv.txt   #
    # Define Variables                                                           #
    #      Detailed Information Found In README File.                            #
    # $mailprog defines the location of your sendmail program on your unix       #
    # system. The flags -i and -t should be passed to sendmail in order to       #
    # have it ignore single dots on a line and to read message for recipients    #
    $mailprog = 'smtp.europe.secureserver.net -i -t';
    # @referers allows forms to be located only on servers which are defined     #
    # in this field.  This is a security fix to prevent others from using your   #
    # FormMail script on their web site.                                         #
    @referers = ('refuseboredom.com');
    # @recipients defines the e-mail addresses or domain names that e-mail can   #
    # be sent to.  This must be filled in correctly to prevent SPAM and allow    #
    # valid addresses to receive e-mail.  Read the documentation to find out how #
    # this variable works!!!  It is EXTREMELY IMPORTANT.                         #
    @recipients = ('^admin\@refuseboredom\.com');
    # ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
    # @valid_ENV allows the sysadmin to define what environment variables can    #
    # be reported via the env_report directive.  This was implemented to fix     #
    # the problem reported at http://www.securityfocus.com/bid/1187              #
    @valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');
    # Done                                                                       #
    # Check Referring URL
    &check_url;
    # Retrieve Date
    &get_date;
    # Parse Form Contents
    &parse_form;
    # Check Required Fields
    &check_required;
    # Send E-Mail
    &send_mail;
    # Return HTML Page or Redirect User
    &return_html;
    # NOTE rev1.91: This function is no longer intended to stop abuse, that      #
    #    functionality is now embedded in the checks made on @recipients and the #
    #    recipient form field.                                                   #
    sub check_url {
        # Localize the check_referer flag which determines if user is valid.     #
        local($check_referer) = 0;
        # If a referring URL was specified, for each valid referer, make sure    #
        # that a valid referring URL was passed to FormMail.                     #
        if ($ENV{'HTTP_REFERER'}) {
            foreach $referer (@referers) {
                if ($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$referer|i) {
                    $check_referer = 1;
                    last;
        else {
            $check_referer = 1;
        # If the HTTP_REFERER was invalid, send back an error.                   #
        if ($check_referer != 1) { &error('bad_referer') }
    sub get_date {
        # Define arrays for the day of the week and month of the year.           #
        @days   = ('Sunday','Monday','Tuesday','Wednesday',
                   'Thursday','Friday','Saturday');
        @months = ('January','February','March','April','May','June','July',
                   'August','September','October','November','December');
        # Get the current time and format the hour, minutes and seconds.  Add    #
        # 1900 to the year to get the full 4 digit year.                         #
        ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
        $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
        $year += 1900;
        # Format the date.                                                       #
        $date = "$days[$wday], $months[$mon] $mday, $year at $time";
    sub parse_form {
        # Define the configuration associative array.                            #
        %Config = ('recipient','',          'subject','',
                   'email','',              'realname','',
                   'redirect','',           'bgcolor','',
                   'background','',         'link_color','',
                   'vlink_color','',        'text_color','',
                   'alink_color','',        'title','',
                   'sort','',               'print_config','',
                   'required','',           'env_report','',
                   'return_link_title','',  'return_link_url','',
                   'print_blank_fields','', 'missing_fields_redirect','');
        # Determine the form's REQUEST_METHOD (GET or POST) and split the form   #
        # fields up into their name-value pairs.  If the REQUEST_METHOD was      #
        # not GET or POST, send an error.                                        #
        if ($ENV{'REQUEST_METHOD'} eq 'GET') {
            # Split the name-value pairs
            @pairs = split(/&/, $ENV{'QUERY_STRING'});
        elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
            # Get the input
            read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
            # Split the name-value pairs
            @pairs = split(/&/, $buffer);
        else {
            &error('request_method');
        # For each name-value pair:                                              #
        foreach $pair (@pairs) {
            # Split the pair up into individual variables.                       #
            local($name, $value) = split(/=/, $pair);
            # Decode the form encoding on the name and value variables.          #
            # v1.92: remove null bytes                                           #
            $name =~ tr/+/ /;
            $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
            $name =~ tr/\0//d;
            $value =~ tr/+/ /;
            $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
            $value =~ tr/\0//d;
            # If the field name has been specified in the %Config array, it will #
            # return a 1 for defined($Config{$name}}) and we should associate    #
            # this value with the appropriate configuration variable.  If this   #
            # is not a configuration form field, put it into the associative     #
            # array %Form, appending the value with a ', ' if there is already a #
            # value present.  We also save the order of the form fields in the   #
            # @Field_Order array so we can use this order for the generic sort.  #
            if (defined($Config{$name})) {
                $Config{$name} = $value;
            else {
                if ($Form{$name} ne '') {
                    $Form{$name} = "$Form{$name}, $value";
                else {
                    push(@Field_Order,$name);
                    $Form{$name} = $value;
        # The next six lines remove any extra spaces or new lines from the       #
        # configuration variables, which may have been caused if your editor     #
        # wraps lines after a certain length or if you used spaces between field #
        # names or environment variables.                                        #
        $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
        $Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
        $Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
        $Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
        $Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
        $Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
        # Split the configuration variables into individual field names.         #
        @Required = split(/,/,$Config{'required'});
        @Env_Report = split(/,/,$Config{'env_report'});
        @Print_Config = split(/,/,$Config{'print_config'});
        # ACCESS CONTROL FIX: Only allow ENV variables in @valid_ENV in          #
        # @Env_Report for security reasons.                                      #
        foreach $env_item (@Env_Report) {
            foreach $valid_item (@valid_ENV) {
                if ( $env_item eq $valid_item ) { push(@temp_array, $env_item) }
        @Env_Report = @temp_array;
    sub check_required {
        # Localize the variables used in this subroutine.                        #
        local($require, @error);
        # The following insures that there were no newlines in any fields which  #
        # will be used in the header.                                            #
        if ($Config{'subject'} =~ /(\n|\r)/m || $Config{'email'} =~ /(\n|\r)/m ||
            $Config{'realname'} =~ /(\n|\r)/m || $Config{'recipient'} =~ /(\n|\r)/m) {
            &error('invalid_headers');
        # Fix XSS + HTTP Header Injection for v1.93
        foreach $lfield ('redirect', 'return_link_url') {
            # Strip new lines
            $Config{$lfield} =~ s/(\n|\r)//mg;
            # Only allow certain handlers to avoid javascript:/data: tricks
            if ($Config{$lfield} !~ /^\s*\// &&
                $Config{$lfield} !~ /^\s*(http|https|ftp):\/\//) {
                $Config{$lfield} = '';
        if (!$Config{'recipient'}) {
            if (!defined(%Form)) { &error('bad_referer') }
            else                 { &error('no_recipient') }
        else {
            # This block of code requires that the recipient address end with    #
            # a valid domain or e-mail address as defined in @recipients.        #
            foreach $send_to (split(/,/,$Config{'recipient'})) {
                foreach $recipient (@recipients) {
                    if ($send_to =~ /$recipient$/i) {
                        push(@send_to,$send_to); last;
            if ($#send_to < 0) { &error('no_recipient') }
            $Config{'recipient'} = join(',',@send_to);
        # For each require field defined in the form:                            #
        foreach $require (@Required) {
            # If the required field is the email field, the syntax of the email  #
            # address if checked to make sure it passes a valid syntax.          #
            if ($require eq 'email' && !&check_email($Config{$require})) {
                push(@error,$require);
            # Otherwise, if the required field is a configuration field and it   #
            # has no value or has been filled in with a space, send an error.    #
            elsif (defined($Config{$require})) {
                if ($Config{$require} eq '') { push(@error,$require); }
            # If it is a regular form field which has not been filled in or      #
            # filled in with a space, flag it as an error field.                 #
            elsif (!defined($Form{$require}) || $Form{$require} eq '') {
                push(@error,$require);
        # If any error fields have been found, send error message to the user.   #
        if (@error) { &error('missing_fields', @error) }
    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'}\">$safeConfig{'return_link_title'}</a>\n";
                print "</ul>\n";
            # Print the page footer.                                             #
            print <<"(END HTML FOOTER)";
            <hr size=1 width=75%><p>
            <center><font size=-1><a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
    A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a></font></center>
            </body>
           </html>
    (END HTML FOOTER)
    sub send_mail {
        # Localize variables used in this subroutine.                            #
        local($print_config,$key,$sort_order,$sorted_field,$env_report);
        # Open The Mail Program
        open(MAIL,"|$mailprog");
        print MAIL "To: $Config{'recipient'}\n";
        print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
        # Check for Message Subject
        if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
        else                    { print MAIL "Subject: WWW Form Submission\n\n" }
        print MAIL "Below is the result of your feedback form.  It was submitted by\n";
        print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
        print MAIL "-" x 75 . "\n\n";
        if (@Print_Config) {
            foreach $print_config (@Print_Config) {
                if ($Config{$print_config}) {
                    print MAIL "$print_config: $Config{$print_config}\n\n";
        # If a sort order is specified, sort the form fields based on that.      #
        if ($Config{'sort'} =~ /^order:.*,.*/) {
            # Remove extraneous line breaks and spaces, remove the order:        #
            # directive and split the sort fields into an array.                 #
            local $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) {
                if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') {
                    print MAIL "$sorted_field: $Form{$sorted_field}\n\n";
        # Otherwise, print fields in order they were sent or alphabetically.     #
        else {
            # Sort alphabetically if specified:                                  #
            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) {
                if ($Config{'print_blank_fields'} || $Form{$field} ne '') {
                    print MAIL "$field: $Form{$field}\n\n";
        print MAIL "-" x 75 . "\n\n";
        # Send any specified Environment Variables to recipient.                 #
        foreach $env_report (@Env_Report) {
            if ($ENV{$env_report}) {
                print MAIL "$env_report: $ENV{$env_report}\n";
        close (MAIL);
    sub check_email {
        # Initialize local email variable with input to subroutine.              #
        $email = $_[0];
        # If the e-mail address contains:                                        #
        if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
            # the e-mail address contains an invalid syntax.  Or, if the         #
            # syntax does not match the following regular expression pattern     #
            # it fails basic syntax verification.                                #
            $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z0-9]+)(\]?)$/) {
            # Basic syntax requires:  one or more characters before the @ sign,  #
            # followed by an optional '[', then any number of letters, numbers,  #
            # dashes or periods (valid domain/IP characters) ending in a period  #
            # and then 2 or 3 letters (for domain suffixes) or 1 to 3 numbers    #
            # (for IP addresses).  An ending bracket is also allowed as it is    #
            # valid syntax to have an email address like: user@[255.255.255.0]   #
            # Return a false value, since the e-mail address did not pass valid  #
            # syntax.                                                            #
            return 0;
        else {
            # Return a true value, e-mail verification passed.                   #
            return 1;
    # This was added into v1.91 to further secure the recipients array.  Now, by #
    # default it will assume that valid recipients include only users with       #
    # usernames A-Z, a-z, 0-9, _ and - that match your domain exactly.  If this  #
    # is not what you want, you should read more detailed instructions regarding #
    # the configuration of the @recipients variable in the documentation.        #
    sub fill_recipients {
        local(@domains) = @_;
        local($domain,@return_recips);
        foreach $domain (@domains) {
            if ($domain =~ /^\d+\.\d+\.\d+\.\d+$/) {
                $domain =~ s/\./\\\./g;
                push(@return_recips,'^[\w\-\.]+\@\[' . $domain . '\]');
            else {
                $domain =~ s/\./\\\./g;
                $domain =~ s/\-/\\\-/g;
                push(@return_recips,'^[\w\-\.]+\@' . $domain);
        return @return_recips;
    # This function will convert <, >, & and " to their HTML equivalents.        #
    sub clean_html {
        local $value = $_[0];
        $value =~ s/\&/\&amp;/g;
        $value =~ s/</\&lt;/g;
        $value =~ s/>/\&gt;/g;
        $value =~ s/"/\&quot;/g;
        return $value;
    sub body_attributes {
        # Check for Background Color
        if ($Config{'bgcolor'}) { print " bgcolor=\"$safeConfig{'bgcolor'}\"" }
        # Check for Background Image
        if ($Config{'background'}) { print " background=\"$safeConfig{'background'}\"" }
        # Check for Link Color
        if ($Config{'link_color'}) { print " link=\"$safeConfig{'link_color'}\"" }
        # Check for Visited Link Color
        if ($Config{'vlink_color'}) { print " vlink=\"$safeConfig{'vlink_color'}\"" }
        # Check for Active Link Color
        if ($Config{'alink_color'}) { print " alink=\"$safeConfig{'alink_color'}\"" }
        # Check for Body Text Color
        if ($Config{'text_color'}) { print " text=\"$safeConfig{'text_color'}\"" }
    sub error {
        # Localize variables and assign subroutine input.                        #
        local($error,@error_fields) = @_;
        local($host,$missing_field,$missing_field_list);
        if ($error eq 'bad_referer') {
            if ($ENV{'HTTP_REFERER'} =~ m|^https?://([\w\.]+)|i) {
                $host = $1;
                my $referer = &clean_html($ENV{'HTTP_REFERER'});
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>Bad Referrer - Access Denied</title>
    </head>
    <body bgcolor=#FFFFFF text=#000000>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>Bad Referrer - Access Denied</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><td>The form attempting to use
         <a href="http://www.scriptarchive.com/formmail.html">FormMail</a>
         resides at <tt>$referer</tt>, which is not allowed to access
         this cgi script.<p>
         If you are attempting to configure FormMail to run with this form, you need
         to add the following to \@referers, explained in detail in the
         <a href="http://www.scriptarchive.com/readme/formmail.html">README</a> file.<p>
         Add <tt>'$host'</tt> to your <tt><b>\@referers</b></tt> array.<hr size=1>
         <center><font size=-1>
          <a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
          A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a>
         </font></center>
        </td></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
            else {
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>FormMail v1.93</title>
    </head>
    <body bgcolor=#FFFFFF text=#000000>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>FormMail</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><th><tt><font size=+1>Copyright 1995 - 2009 Matt Wright<br>
            Version 1.93 - Released June 25, 2009<br>
            A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive,
            Inc.</a></font></tt></th></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
        elsif ($error eq 'request_method') {
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>Error: Request Method</title>
    </head>
    <body bgcolor=#FFFFFF text=#000000>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>Error: Request Method</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><td>The Request Method of the Form you submitted did not match
         either <tt>GET</tt> or <tt>POST</tt>.  Please check the form and make sure the
         <tt>method=</tt> statement is in upper case and matches <tt>GET</tt> or <tt>POST</tt>.<p>
         <center><font size=-1>
          <a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
          A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a>
         </font></center>
        </td></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
        elsif ($error eq 'no_recipient') {
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>Error: Bad/No Recipient</title>
    </head>
    <body bgcolor=#FFFFFF text=#000000>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>Error: Bad/No Recipient</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><td>There was no recipient or an invalid recipient specified in the data sent to FormMail.  Please
         make sure you have filled in the <tt>recipient</tt> form field with an e-mail
         address that has been configured in <tt>\@recipients</tt>.  More information on filling in <tt>recipient</tt> form fields and variables can be
         found in the <a href="http://www.scriptarchive.com/readme/formmail.html">README</a> file.<hr size=1>
         <center><font size=-1>
          <a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
          A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a>
         </font></center>
        </td></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
        elsif ($error eq 'invalid_headers') {
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>Error: Bad Header Fields</title>
    </head>
    <body bgcolor=#FFFFFF text=#000000>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>Error: Bad Header Fields</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><td>The header fields, which include <tt>recipient</tt>, <tt>email</tt>, <tt>realname</tt> and <tt>subject</tt> were
         filled in with invalid values. You may not include any newline characters in these parameters.
         More information on filling in these form fields and variables can be
         found in the <a href="http://www.scriptarchive.com/readme/formmail.html">README</a> file.<hr size=1>
         <center><font size=-1>
          <a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
          A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a>
         </font></center>
        </td></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
        elsif ($error eq 'missing_fields') {
            if ($Config{'missing_fields_redirect'}) {
                print "Location: " . &clean_html($Config{'missing_fields_redirect'}) . "\n\n";
            else {
                foreach $missing_field (@error_fields) {
                    $missing_field_list .= "<li>" . &clean_html($missing_field) . "\n";
                print <<"(END ERROR HTML)";
    Content-type: text/html
    <html>
    <head>
      <title>Error: Blank Fields</title>
    </head>
      <center>
       <table border=0 width=600 bgcolor=#9C9C9C>
        <tr><th><font size=+2>Error: Blank Fields</font></th></tr>
       </table>
       <table border=0 width=600 bgcolor=#CFCFCF>
        <tr><td>The following fields were left blank in your submission form:<p>
         <ul>
    $missing_field_list
         </ul><br>
         These fields must be filled in before you can successfully submit the form.<p>
         Please use your browser's back button to return to the form and try again.<hr size=1>
         <center><font size=-1>
          <a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.93 &copy; 1995 - 2009  Matt Wright<br>
          A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a>
         </font></center>
        </td></tr>
       </table>
      </center>
    </body>
    </html>
    (END ERROR HTML)
        exit;

    I haven't used  Matt Wright's scripts in this century, but I'm pretty sure that Perl still needs to go into your CGI bin and the permissions level (chmod) must be set to 755 or possibly 777 for the script to read, write & execute.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Using perl with the HTTP POST method to exchange XML with the Auth service

    Has anyone written a perl script to do this yet?
    I've been trying all day and keep getting "Content is not allowed in prolog.
    I've used the example xml from the docs
    <?xml version="1.0" encoding="UTF-8"?>
    <AuthContext version="1.0">
    <Request authIdentifier="0">
    <NewAuthContext orgName="dc=exampleorg,dc=com">
    </NewAuthContext>
    </Request>
    </AuthContext>
    Then I read the python post at http://swforum.sun.com/jive/thread.jspa?forumID=79&threadID=22370
    and the error changed to Premature end of file.
    this is the portion of perl that is getting the error:
    use strict;
    use LWP::UserAgent;
    use HTTP::Request::Common;
    my $browser = LWP::UserAgent->new(agent => 'xml client');
    my $greeting = <<GREETING;
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RequestSet vers="1.0" svcid="auth" reqid="1">
         <Request>
         <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
         <AuthContext version="1.0">
              <Request authIdentifier="0">
                   <NewAuthContext orgName="dc=belo,dc=com">
                   </NewAuthContext>
              </Request>
         </AuthContext>]]></Request>
    </RequestSet>
    GREETING
    my $response = $browser->request(POST 'http://idpoc1.test.belo.com/amserver/authservice',
                        Content_Type => 'text/xml',
                        Content     => [xmlRequest => $greeting]
    print $response->error_as_HTML unless $response->is_success;

    Your problem seems to lie in the build of the request. Here you use the "sample=$data" which will invalidate the XML itself. I've tested your code changing only the build of the Request and this works fine! Given an XML like this :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <data>
         <txnInfo sourcePartnerCode="6" txnDate="2005.09.08"/>
         <unitOfWorkInfo sourceTicketID="SourceTicket_1" diaryEntry="Diray_1" Status="Status_OK"/>
    </data>
    The Server Stub should look like this :
    #!/usr/bin/perl
    use XML::Simple;
    use Data::Dumper;
    print qq{Content-type: text/xml\n\n};
    if($ENV{'REQUEST_METHOD'} eq "GET"){
         $my_data = $ENV{'QUERY_STRING'};
         print "jfghdsfjghsdg$my_data";
    } else {
         $data_length = $ENV{'CONTENT_LENGTH'};
         $bytes_read = read(STDIN, $my_data, $data_length);
         print "$bytes_read, $my_data";
         $xml = new XML::Simple (KeyAttr=>[]);
         print "have passed XML::Simple creation\n";
         $data = $xml->XMLin("$my_data");
         print "i want to be here \n";
         $transcode=$data->{txnInfo}->{sourcePartnerCode};
         #print "$data->{txnInfo}->{sourcePartnerCode}";
         print $transcode;
         CASE: {
              ($transcode==6) && do {
                   print "i am here";
                   $lstmoddat=$data->{txnInfo}->{txnDate};
                   $srctktid=$data->{unitOfWorkInfo}->{sourceTicketID};
                   $actvtylogdesc=$data->{unitOfWorkInfo}->{diaryEntry};
                   $status=$data->{unitOfWorkInfo}->{Status};
                   $command='bop_cmd -f update1.frg "upd_stats("""Administrator""","""'.$srctktid.'""","""FIP""","""what is this???""")"';
                   print "$lstmoddat $srctktid $status \n";
                   print "$command";
                   system("$command");
                   print "i am done";
                   last CASE;
    And the client stub should look like this :
    use LWP::UserAgent;
    use HTTP::Request;
    use IO;
    #use XML::Writer;
    my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30, );
    open INPUT, "<AcceptIncident.xml";
    my @greeting = <INPUT>; #-- Read file containing XML struct to send
    print "Hello World\n";
    my $data_to_send; #-- And build a string of it
    foreach my $newItem (@greeting) {
         $data_to_send = "$data_to_send$newItem";
    print "Sending \n";
    my $head = HTTP::Headers->new(Content_Type => "text/xml", "ID" => "sample");
    my $req = HTTP::Request->new('POST', 'http://matrix/cgi-bin/test1.pl', $head, "$data_to_send");
    my $response = $ua->request($req);
    print $response->as_string; Also you should make sure you have both HTTP::Request amd XML::Simple installed, orelse this will not work.
    Hope this is of some help to you.

  • Apache - CGI script can't read query string from STDIN

    My Perl CGI script begins as follows:
    if ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
    I dumped all ENV variables at entry, and verified that REQUEST_METHOD = "POST" and CONTENT_LENGTH = 73 (which is correct). QUERY_STRING is null. After the above read statement, $in is still null. Any idea why STDIN is not providing the query string?
    Thanks!
    Chap
    867MHz Powerbook   Mac OS X (10.4.8)  

    Hi--
    This isn't really an answer to the question you asked, but is there a reason you aren't using the Perl CGI module? It's installed by default on OS X and makes this kind of stuff much, much easier. Just add a line like this at the top of your script:
    <pre class="command">use CGI qw(:standard);</pre>Then you can get the paramaters for your script like so:
    <pre class="command">my $value = param('paramname');</pre>No muss, no fuss. You can get more information at the CPAN archive page for this module.
    charlie

  • Forms & Scripts!

    I have just incorporated a basic "Contact Us" form into a website, I contacted my webhost to include a cgi/bin which has been inc. but unfortunately they DO NOT supply a script to make the form work. I downloaded a form from "MATS" which is FormMail.pl and I also have one which was used on a hong kong site! But I just cannot get them to work, I believe that I am not putting in the right required data! Could anyone help me with this? I use DW CS3 but I am very inexpierienced with scripts and code
    Below is the Hong Kong script!
    #!/usr/bin/perl
    # generic forms processor
    # version 0.8b
    # Oct 9, 1996
    # Copyright 1996 by Rod Clark ([email protected])
    # v0.8b
    # No longer requires user to enter an e-mail address, if not specified
    #   with "Required"
    # v0.8
    # Added cc:
    # On user echo page, show to whom e-mail sent.
    # Made ECHO DATA HERE matching case-insensitive and less dependent
    #   on exact comment syntax.
    # Added explanatory note to mail message sent to user.
    # Changed an option on sendmail command line from -oem to -oeq
    # In responses and mail, separated subject more from user data.
    #================================================================
    # configuration
    #================================================================
    # You'll need to set the following variables.
    if ($ENV{'REQUEST_METHOD'} eq "GET")
        $ErrorMessage = "Access is denied.";
        push (@Errors, $ErrorMessage);
        &PrintErrorPage;
        exit;
    # syntax example for using forms on one server:
    @GoodReferrers  = ('homepage.com.hk', (These in red are the old HK hosts)
         'nesta.com.hk',
         'abchk.net');
    # syntax example for using forms on any of several servers:
    # (omit "www" prefix if people can use your URLs without it)
    # @GoodReferrers  = ('www.homepage.com.hk',  (These in red are the old HK hosts)
    #                    'www2.some.org',
    #                    'another.org');
    # Default return prompt to display on the standard echo page:
    # (Applies only if you don't specify a return link on the form
    # with a hidden $ReturnLinkURL, and HTTP_REFERER is unavailable.)
    $DefaultReturnLinkURL   = "http://www.empireantiques.com.au/";
    $DefaultReturnLinkTitle = "Return to Home Page";
    # Defaults for the mailto link on the echo page:
    # (Applies only if your mailto address is not specified on the
    # form with a hidden "to" or "MailtoAddress.")
    # NOTE: Escape the @ in addresses here, by using \@
    $DefaultMailtoPrompt    = "Questions:";
    $DefaultMailtoAddress   = "[email protected]";
    $DefaultMailtoName      = "[email protected]";
    # These are for e-mailing the form results, not printing a
    # mailto link on the echo page as with the previous addresses.
    # NOTE: Escape the @ in addresses here, by using \@
    $DefaultFrom            = "[email protected]";
    $DefaultSubject         = "Web Form Data";
    $UseDefaultTo           = 1;
    # webmaster (or whatever address you choose) lets people reply
    # to an address other than "nobody"
    $DefaultTo              = "[email protected]";
    # Default background color and image for standard echo page:
    # Applies only if you don't define your own echo page with a
    # hidden $EchoFilePath, and $RedirectURL is not used.
    $DefaultBgcolor         = "#FFFFE4";
    #$DefaultBackground      = "/images/ivory.gif";
    #=====
    # The following variables are less likely to need editing.
    # But check them anyway.
    $UserMailNote   = "For your records, this is what you entered on the form.";
    # (If you see a "Form Error" message during installation,
    # a bad path to $Mailprogram is the most likely cause.
    # Check the actual location with "which sendmail".)
    # -oeq avoids some difficulties if address is invalid
    $MailProgram    = '/usr/sbin/sendmail -t -i ';
    # prevents reading other than HTML files
    $GoodFileExts   = "\.htm|\.html";
    # if debug is on, redirection will not work.
    $Debug = 0;
    #================================================================
    # end of configuration
    #================================================================
    &CheckReferrer;
    &GetTime;
    &ParseForm;
    &CheckRequiredFields;
    &SendMail;
    if ($Debug)
      &PrintDebugPage;
    else
      &PrintEchoPageOrRedirect;
    #================================================================
    # subroutines
    #================================================================
    sub CheckReferrer
      $Referrer = $ENV{'HTTP_REFERER'};
      # translate to lowercase
      $Referrer = "\L$Referrer\E";
      $ReferrerOK = 0;
      if ($Referrer)
        $NumGoodReferrers = @GoodReferrers;
        for ($RefIndex = 0; $RefIndex < $NumGoodReferrers; $RefIndex++)
          if ($Referrer =~ +$GoodReferrers[$RefIndex]+i)
            $ReferrerOK = 1;
      else
        $ReferrerOK = 1;
      if (!$ReferrerOK)
        $ErrorMessage = "The form at <b>$Referrer</b> is outside our domain. Access is denied.";
        push (@Errors, $ErrorMessage);
        &PrintErrorPage;
        exit;
    sub GetTime
      @Days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',
        'Saturday');
      @Months = ('January','February','March','April','May','June','July',
        'August','September','October','November','December');
      ($Sec, $Min, $Hour, $MonthDay, $Month, $Year, $WeekDay, $YearDay, $IsDST)
        = localtime (time);
      if ($Hour < 10)
        {$Hour = "0$Hour";}
      if ($Min < 10)
        {$Min = "0$Min";}
      $Time = "$Hour\:$Min on $Days[$WeekDay], $Months[$Month] $MonthDay";
    sub ParseForm
      &ReadParse;
      $to                 = $in{'to'};              # "to" is always needed
      $cc                 = $in{'cc'};
      $bcc                 = $in{'bcc'};
      $email              = $in{'email'};           # equivalent to "from"
      $subject            = $in{'subject'};
      $ReturnLinkURL      = $in{'ReturnLinkURL'};
      $ReturnLinkTitle    = $in{'ReturnLinkTitle'};
      $RedirectURL        = $in{'RedirectURL'};
      $EchoFilePath       = $in{'EchoFilePath'};
      $MailtoPrompt       = $in{'MailtoPrompt'};
      $MailToAddress      = $in{'MailtoAddress'};
      $MailtoName         = $in{'MailtoName'};
      $Required           = $in{'Required'};
      # remove spaces
      $Required           =~ s/ +//g;
      @RequiredFields     = split (/,/, $Required);
      # disallow most special chars, and paths starting with .
      if (($EchoFilePath =~ /[^a-zA-Z0-9-\$_\.\/\~]/) || ($EchoFilePath =~ /^\./))
        $EchoFilePath = '';
      foreach $Part (@in)
        # convert hex values (e.g. %0A) to ASCII characters
        $Part =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        ($Key, $Val) = split (/=/, $Part, 2);
        $Val =~ s/\n/<br>/g;
        if (($Key eq 'to')
        || ($Key eq 'cc')
        || ($Key eq 'bcc')
        || ($Key eq 'subject')
        || ($Key eq 'RedirectURL')
        || ($Key eq 'ReturnLinkURL')
        || ($Key eq 'ReturnLinkTitle')
        || ($Key eq 'Required')
        || ($Key eq 'EchoFilePath'))
          if ($Key eq 'EchoFilePath')
            push (@ScriptPairs, $Key."=".$EchoFilePath);
          else
            push (@ScriptPairs, $Key."=".$Val);
        else
          push (@UserPairs, $Key."=".$Val);
    sub CheckRequiredFields
      if (!$to && !$MailtoAddress && !$UseDefaultTo)
        $ErrorMessage = "This form cannot be sent to its intended recipient.\nPlease send e-mail directly.";
        push (@Errors, $ErrorMessage);
        &PrintErrorPage;
        exit;
      else
    if ($to){
      $tmR = "\L$to\E";
      $toOK = 0;
          if ($to=~ /^[\w-.]+\@[\w-.]+$/)
            $toOK = 1;
          else
            $MissingMessage = "Your e-mail address (<b>$to</b>) isn't in the usual form. Please make sure it's correct.";
            push (@MissingMessages, $MissingMessage);
      if ($tmR)
        $NumGoodReferrers = @GoodReferrers;
        for ($RefIndex = 0; $RefIndex < $NumGoodReferrers; $RefIndex++)
          if ($tmR =~ +$GoodReferrers[$RefIndex]+i)
            $toOK = 1;
        if (!$toOK){
                    $MissingMessage = "Your send email address (<b>$to</b>) isn't in our scope.";
            push (@MissingMessages, $MissingMessage);
    if ($bcc){
      $tmR = "\L$bcc\E";
      $bccOK = 0;
          if ($bcc=~ /^[\w-.]+\@[\w-.]+$/)
            $bccOK = 1;
          else
            $MissingMessage = "Your e-mail address (<b>$bcc</b>) isn't in the usual form. Please make sure it's correct.";
            push (@MissingMessages, $MissingMessage);
      if ($tmR)
        $NumGoodReferrers = @GoodReferrers;
        for ($RefIndex = 0; $RefIndex < $NumGoodReferrers; $RefIndex++)
          if ($tmR =~ +$GoodReferrers[$RefIndex]+i)
            $bccOK = 1;
        if (!$bccOK){
                    $MissingMessage = "Your send email address (<b>$bcc</b>) isn't in our scope.";
            push (@MissingMessages, $MissingMessage);
    if ($subject){
      $tmR = "\L$subject\E";
      $subOK = 0;
      $position = rindex($subject, "bcc") ;
      $positioncc = rindex($subject, "cc:") ;
      $positioncxc = rindex($subject, "cc :") ;
      $positionto = rindex($subject, "to:") ;
      $positiontoi = rindex($subject, "to :") ;
          if ($position<0 && $positioncc<0 && $positioncxc<0 && $positionto<0 && $positiontoi<0)
            $subOK = 1;
          else
            $MissingMessage = "Your subject(<b>$subject</b>) isn't in the usual form. Please make sure it's correct.";
            push (@MissingMessages, $MissingMessage);
        if ($email)
          if ($email =~ /^[\w-.]+\@[\w-.]+$/)
            $EmailOK = 1;
          else
            $MissingMessage = "Your e-mail address (<b>$email</b>) isn't in the usual form. Please make sure it's correct.";
            push (@MissingMessages, $MissingMessage);
        if ($Required)
          foreach $RequiredField (@RequiredFields)
            foreach $UserPair (@UserPairs)
              ($UserKey, $UserVal) = split (/=/, $UserPair, 2);
              if ($RequiredField eq $UserKey)
                if (!$UserVal)
                  $MissingMessage = "The required <b>$RequiredField</b> field is missing. Please include it on the form.";
                  push (@MissingMessages, $MissingMessage);
        $FieldsMissing = @MissingMessages;
        if ($FieldsMissing)
          &PrintRequiredFieldsPage;
          exit;
    sub PrintEchoPageOrRedirect
      if ($RedirectURL)
        print "Location: $RedirectURL\n\n";
      &PrintEchoPage;
    sub PrintEchoPage
      # check that the echo file is an HTML file
      # change filepath to lowercase
      $EchoFilePathLC = $EchoFilePath;
      $EchoFilePathLC = "\L$EchoFilePathLC\E";
      if ($EchoFilePathLC =~ /$GoodFileExts$/)
        &PrintUserEchoPage;
      else
        &PrintStandardEchoPage;
    sub PrintUserEchoPage
      # Print $EchoFilePath file until encounter <!--ECHO DATA HERE-->
      # Then print the user pairs from the form.
      # Then print the rest of the file.
      # If ECHO DATA HERE is not found, then print the file
      # without inserting variables from the form.
      if (open (ECHOFILE, $EchoFilePath))
        &PrintHeader;
        $EchoFileLine = <ECHOFILE>;
        while ($EchoFileLine ne '')
          if (($EchoFileLine =~ /<!--/) && ($EchoFileLine =~ /ECHO DATA HERE/i))
            print "<p>\n";
            print "$MailerMessage\n";
            print "<p>\n";
            if ($subject)
              print "<b>Subject:</b> $subject\n";
            else
              print "<b>Subject:</b> $DefaultSubject\n";
            print "<p>\n";
            &PrintUserPairs;
          else
            print "$EchoFileLine";
          $EchoFileLine = <ECHOFILE>;
        close (ECHOFILE);
      else
        &PrintStandardEchoPage;
    sub PrintStandardEchoPage
      &PrintHeader;
      print <<ENDPRINT;
    <html>
    <head>
    <title>Thank You</title>
    </head>
    <body bgcolor="$DefaultBgcolor" background="$DefaultBackground">
    ENDPRINT
      print <<ENDPRINT;
    <h2>Thank You</h2>
    This is what you entered on the form.<br>
    $MailerMessage
    <p>
    ENDPRINT
      if ($subject)
        print "<b>Subject:</b> $subject\n";
      else
        print "<b>Subject:</b> $DefaultSubject\n";
      print "<hr>\n";
      print "<blockquote>\n";
      &PrintUserPairs;
      print "</blockquote>\n";
      print "<hr>\n";
      &PrintMailto;
      print "<p>\n";
      &PrintReturnLink;
      &PrintPageFooter;
    sub PrintRequiredFieldsPage
      &PrintHeader;
      print <<ENDPRINT;
    <html>
    <head>
    <title>Please Fill Out Required Fields</title>
    </head>
    <body bgcolor="$DefaultBgcolor" background="$DefaultBackground">
    ENDPRINT
      print <<ENDPRINT;
    <h2>Please Fill Out Required Fields</h2>
    <hr>
    <ul>
    ENDPRINT
      foreach $MessageLine (@MissingMessages)
        print "<p>\n";
        print "<li>$MessageLine\n\n";
      print "</ul>\n";
      print "</center>\n";
      print "<hr>\n";
      &PrintMailto;
      print "<p>\n";
      &PrintReturnLink;
      &PrintPageFooter;
    sub PrintErrorPage
      &PrintHeader;
      print <<ENDPRINT;
    <title>Form Error</title>
    </head>
    <body bgcolor="$DefaultBgcolor" background="$DefaultBackground">
    <h2>Form Error</h2>
    <hr>
    <ul>
    ENDPRINT
      foreach $ErrorLine (@Errors)
        print "<p>\n";
        print "<li>$ErrorLine\n\n";
      print <<ENDPRINT;
    </ul>
    </center>
    <hr>
    ENDPRINT
      &PrintMailto;
      &PrintReturnLink;
      &PrintPageFooter;
    sub PrintDebugPage
      &PrintHeader;
      print <<ENDPRINT;
    <html>
    <head>
    <title>Debug Page</title>
    </head>
    <body bgcolor="$DefaultBgcolor" background="$DefaultBackground">
    ENDPRINT
      # script fields
      print "<i>Script fields:</i><br>\n";
      foreach $ScriptPair (@ScriptPairs)
        ($ScriptKey, $ScriptVal) = split (/=/, $ScriptPair, 2);
        print "<b>$ScriptKey:</b> $ScriptVal<br>\n";
      # user fields
      print "<hr>";
      print "<i>User fields:</i><br>\n";
      foreach $UserPair (@UserPairs)
        ($UserKey, $UserVal) = split (/=/, $UserPair, 2);
        print "<b>$UserKey:</b> $UserVal<br>\n";
      # required fields
      # missing field messages
      print "<hr>";
      print "<i>Required fields:</i><br>\n";
      foreach $RequiredField (@RequiredFields)
        foreach $UserPair (@UserPairs)
          ($UserKey, $UserVal) = split (/=/, $UserPair, 2);
          if ($RequiredField eq $UserKey)
            print "<b>$UserKey:</b> $UserVal<br>\n";
      print "<p><i>Missing field messages:</i><br>\n";
      foreach $MissingMessage (@MissingMessages)
        print "<p>\n";
        print "$MissingMessage\n";
      # errors
      print "<hr>";
      print "<i>Errors:</i><br>\n";
      foreach $ErrorLine (@Errors)
        print "$ErrorLine\n\n";
    sub PrintUserPairs
      foreach $UserPair (@UserPairs)
        ($UserKey, $UserVal) = split (/=/, $UserPair, 2);
        print "<b>$UserKey:</b> $UserVal<br>\n";
    sub PrintMailto
      if ($MailtoPrompt)
        $PrintPrompt = $MailtoPrompt;
      else
        $PrintPrompt = $DefaultMailtoPrompt;
      if ($to)
        print "$PrintPrompt <a href=\"mailto:$to\">$to</a>\n";
      elsif ($MailtoAddress)
        if ($MailtoName)
          print "$PrintPrompt <a href=\"mailto:$MailtoAddress\">$MailtoName</a>\n";
        else
          print "$PrintPrompt <a href=\"mailto:$MailtoAddress\">$MailtoAddress</a>\n";
      else
        if ($DefaultMailtoAddress)
          if ($DefaultMailtoName)
            print "$DefaultMailtoPrompt <a href=\"mailto:$DefaultMailtoAddress\">$DefaultMailtoName</a>\n";
          else
            print "$DefaultMailtoPrompt <a href=\"mailto:$DefaultMailtoAddress\">$DefaultMailtoAddress</a>\n";
    sub PrintReturnLink
      # If the user's return link name is defined, print a link to it.
      # If not, but the referring page is known, print a link to it.
      # If not, then print a link to the default home page, if it's defined.
      if ($ReturnLinkURL)
        if ($ReturnLinkTitle)
          print "<p>\n<b><a href=\"$ReturnLinkURL\">$ReturnLinkTitle</a></b>\n";
        else
          print "<p>\n<b>Return to <a href=\"$ReturnLinkURL\">$ReturnLinkURL</a></b>\n";
      else
        if ($Referrer)
          print "<p>\n<b><a href=\"$Referrer\">Return to the Form</a></b><br>\n";
        else
          if (($DefaultReturnURL) && ($DefaultReturnTitle))
            print "<p>\n<b><a href=\"$ReturnLinkURL\">$ReturnLinkTitle</a></b>\n";
    sub PrintPageFooter
      print <<ENDPRINT;
    </body>
    </html>
    ENDPRINT
    sub SendMail
      $CanSendMail = 0;
      if (open (MAIL,"|-") || exec "$MailProgram")
        if ($to)
          $MailedTo = $to;
          $CanSendMail = 1;
        else
          if ($UseDefaultTo)
            $MailedTo = $DefaultTo;
            $CanSendMail = 1;
        if ($email)
          $MailedFrom = $email;
        else
          $MailedFrom = $DefaultFrom;
        if ($subject)
          $MailedSubject = $subject;
        else
          $MailedSubject = $DefaultSubject;
        if ($CanSendMail)
          print MAIL "To: $MailedTo\n";
          if ($cc)
            print MAIL "Cc: $cc\n";
          print MAIL "From: $MailedFrom\n";
          print MAIL "Subject: $MailedSubject\n\n";
          &MailSystemData;
          print MAIL "Subject: $MailedSubject\n";
          print MAIL "\n";
          &MailUserPairs;
          close (MAIL);
          $MailerMessage = "Mailed at $Time to <b>$MailedTo</b>\n";
          if ($cc)
            $MailerMessage = $MailerMessage."<br>cc: to <b>$cc</b>\n";
          if ($EmailOK)
            # &MailCopyToFormFiller;
        else
          close (MAIL);
          $ErrorMessage = "Form data cannot be sent: no recipient.\n";
          &PrintErrorPage;
          exit;
      else
        $ErrorMessage = "Could not open mail program.\n";
        &PrintErrorPage;
        exit;
    sub MailCopyToFormFiller
      # send a copy to whoever filled out the form
      if ($email)
        if (open (MAIL,"|-") || exec "$MailProgram")
          print MAIL "To: $email\n";
          print MAIL "From: $MailedTo\n";
          print MAIL "Subject: $MailedSubject\n\n";
          &MailSystemData;
          print MAIL "$UserMailNote\n\n";
          print MAIL "Subject: $MailedSubject\n";
          print MAIL "\n";
          &MailUserPairs;
          close (MAIL);
          $MailerMessage = $MailerMessage."<br>Duplicate mailed to <b>$email</b>";
    sub MailSystemData
      print MAIL "Data entered from: $Referrer\n";
      print MAIL "\n";
    sub MailUserPairs
      foreach $UserPair (@UserPairs)
        ($UserKey, $UserVal) = split (/=/, $UserPair, 2);
        $UserVal =~ s/<br>/\n/g;
        print MAIL "$UserKey: $UserVal\n";
    #=====================================================================
    # GENERAL PURPOSE (BOILERPLATE) ROUTINES
    #=====================================================================
    # from cgi-lib.pl v1.14
    # (these routines copyright by Steven Brenner)
    sub ReadParse
      local (*in) = @_ if @_;
      local ($i, $key, $val);
      # Read in text
      if (&MethGet)
        $in = $ENV{'QUERY_STRING'};
      elsif (&MethPost)
        read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
      @in = split(/[&;]/,$in);
      foreach $i (0 .. $#in)
        # Convert plusses to spaces
        $in[$i] =~ s/\+/ /g;
        # Split into key and value
        # splits on the first =
        ($key, $val) = split(/=/,$in[$i],2);
        # Convert %XX from hex numbers to alphanumeric
        $key =~ s/%(..)/pack("c",hex($1))/ge;
        $val =~ s/%(..)/pack("c",hex($1))/ge;
        # Associate key and value
        # \0 is the multiple separator
        $in{$key} .= "\0" if (defined($in{$key}));
        $in{$key} .= $val;
      return scalar(@in);
    sub MethGet
    # true if this cgi call was using the GET request, false otherwise
      return ($ENV{'REQUEST_METHOD'} eq "GET");
    sub MethPost
    # true if this cgi call was using the POST request, false otherwise
      return ($ENV{'REQUEST_METHOD'} eq "POST");
    sub PrintHeader
      print "Content-type: text/html\n\n";
      return;

    Refer table TTXFP.
    Form name : TTXFP-TDFORM
    Driver program : TTXFP-PRINT_NAME
    Ref Thread: Driver Programs
    check in SE76 ,
    goto SE76 , Click F4 and then F8 , u canget all the forms
    or
    u can find them in table STXH , TDFORM is the fieldname
    Another way of checking is
    In SE71 and follow the menu
    FORM->CHECK->Text
    There u will get the print program name .
    Regards

  • Help with Simple Perl script, its sooo simple!!!

    i know this isnt java but i need to know how to do this for class for this class is a prerequisite to the java servlets class. Please help, i am just starting to learn perl and this error doesnt make sence to me.
    this is my error...
    Unquoted string "cnt" may clash with future reserved word at c:\inetpub\wwwroot\ANDwebs\cgi-bin\form2.pl line 19.
    Can't modify constant item in postincrement (++) at c:\inetpub\wwwroot\ANDwebs\cgi-bin\form2.pl line 19, near "cnt++"
    Execution of c:\inetpub\wwwroot\ANDwebs\cgi-bin\form2.pl aborted due to compilation errors.
    this is my code...
    #!/usr/bin/perl -w
    print "Content-type: text/html \n\n";
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @fields = qw(fullName compName add1 add2 city state zip email dayPhone evePhone fax);
    @pairs = split(/&/, $buffer);
    @values;
    $cnt;
    foreach $key (@pairs)
    ($name, $value) = split(/=/, $key);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
    $value =~ s/<!--(.|\n)*-->//g;
    $values[cnt++] = $value;
    foreach $key (@fields){
    print "$key";
    }

    $values[cnt++] = $value;cnt should be $cnt.
    Also remember to always put:
    use strict;
    at the beginning of all your Perl programs!!!
    However, the fact that this is for a class that is a prerequisite for a Java class doesn't make this a Java question. Please post your Perl questions to the comp.lang.perl.* newsgroups.

  • URL writing

    Hi,
    I am getting very confused ! I have a prog that reads a file from a web server, and displays it in a TextArea. The user can then change the data in this TextArea, and I then want ot write it back to the web server. The number of choices for doing this seem vast, which is the best one to use ? I read the file like this :
    URL source = new URL(getCodeBase(), f);
    URLConnection url = source.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(source.openStream()));
    while(section < 6) {  // read all data lines, for 5 sections.
              data = in.readLine();
              rawArray[rawCt]=data; //populate the rawArray;
              rawCt++;
    Once I have an array of data, I populate the textarea (tArea1) and change it about. I then want to put it back, but my little grey cells are no longer working. Can someone please help !
    regards
    KPJ

    Hi Guys,
    for reference, I sorted this problem out. I needed to use a perl cgi prog
    to take the data and save it. The java code had to emulate the HTTP POST command, and getting the syntax sorted for this was interesting ! The working solution for anyone interested is as follows:
    public void SendData(String data) throws Exception {
         tArea1.append("\n\n************   Sending Data   ************\n");
         URL url = new URL("http","www.lagfc.co.uk","/cgi-bin/PerlUpdate.cgi");
         URLConnection ucon = url.openConnection();
         ucon.setDoOutput(true);
         ucon.setDoInput(true);
         ucon.setUseCaches(false);
         ucon.setRequestProperty("Content-type", "text/plain");
         ucon.setRequestProperty("Content-length", data.length()+"");
              PrintStream out = new PrintStream(ucon.getOutputStream());
         out.print(data);
         out.flush();
         out.close();
         tArea1.setText("*************************************");
         tArea1.append("\n*****     Data sent to host     *****\n");
              DataInputStream in = new DataInputStream(ucon.getInputStream());
         String s;
         while((s=in.readLine()) !=null){ // Read in response from CGI
         tArea1.append(s);
         in.close();
              tArea1.append("\n*************************************\n");
       } // end of sendDataThe CGI File that handles the data is
    #! /usr/bin/perl
    # This program allows a java Applet to write direct to a web server  #
    # It is based on an article "Java Jive" by Scott Clark               #
    $Fname = "e:/absolute/address/of/file/14.rst";
    $SFC = "e:/absolute/address/of/file/savecount.dat";
    # example "e:/domains/mydomain.co.uk/Stats/Under14.rst"
    print "content-type: text/html\n\n";
    # print content type header top the browser
    if ($ENV{ 'REQUEST_METHOD'} eq 'POST'){
         read(STDIN,$datain, $ENV{ 'CONTENT_LENGTH'});
         open(SFC, $SFC) or die "Can't open Save Count File";
         $count = <SFC>;
         close(SFC);
         $Backup = substr($Fname,0,length($Fname)-3).$count;
         if (-e $Backup) {unlink($Backup); } # if the $Backup file exists, delete and then....
         rename($Fname,$Backup);            # rename current file to latest save file
         open(SFC,">$SFC");
         $count = $count+1;
         if ($count eq 1000){
              $count = 995;                 # change this number to 997 for 3 backup files
         }                                     # or 990 for 10 backup files
         print SFC $count;                   # increment the save file count
         close (SFC);     
         open(OUT,">$Fname") or die "Session not possible:$!";
         print OUT $datain;                   # write out the new data file
         print "*****  Data Transfer completed  *****";
    close(OUT);
    #close the filehandle
    exit 0;
    #exit the code
    1; #return trueThe cgi file will keep a number of file copies for you. A note of caution. Anyone with access to your applet can update the file, and screw your data. Anyone contemplating this approach should be aware of that. This may not be the best approach for what you want to do. I may extend the cgi file to put in a password.... undecided yet.
    Thanks for all the tips from the guys in the forum. Good Luck... KPJ

  • No email being sent after completion of form

    Hi
    Can someone please help!!
    I am setting up a survey form form which is uploaded to http://www.mentalhealthstrategies.co.uk/survey.html
    The only thing is once it is filled in and submitted, the 'thank you' page is loaded but I am not receiving any email to give me the details.
    My CGI script is as below. Can someone please tell me what I have done wrong. I am quite new to scripting and I am not sure what to do next.
    #!/usr/bin/perl
    use CGI::Carp qw(fatalsToBrowser);
    if ($ENV{'REQUEST_METHOD'} eq 'POST') {
    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;
    open (MESSAGE,"| /usr/sbin/sendmail -t");
    print MESSAGE "To: julie.mak\@mentalhealthstrategies.co.uk \n";
    print MESSAGE "From: " . $FORM{name} . ", reader\n";
    print MESSAGE "Subject: Feedback from $FORM{name} \n\n";
    print MESSAGE "Organisaion: $FORM{mail} \n\n";
    print MESSAGE "Question 1:  $FORM{question1} \n\n";
    print MESSAGE "Question 2:  $FORM{question2} \n\n";
    print MESSAGE "Question 3:  $FORM{question3} \n\n";
    print MESSAGE "Question 4:  $FORM{question4} \n\n";
    print MESSAGE "Question 5:  $FORM{question5} \n\n";
    print MESSAGE "Question 6:  $FORM{question6} \n\n";
    print MESSAGE "Question 7:  $FORM{question7} \n\n";
    print MESSAGE "Question 8:  $FORM{question8} \n\n";
    print MESSAGE "Question 9:  $FORM{question9} \n\n";
    print MESSAGE "Question 10:  $FORM{question10} \n\n";
    print MESSAGE "Sent by: $FORM{name}\n";
    close (MESSAGE);
    &thank_you;
    sub thank_you {
    print "Content-type: text/html\n\n";
    print <<EndStart;
    <html>
    <head>
    <title>Thank You</title>
    </head>
    <body bgcolor="#dae7a2" text="#000000">
    <h1>Thank You</h1>
    <p>Your survey has been received. Thanks for taking the time to answer it.</p>
    <hr>
    EndStart
    print <<EndHTML;
    </body>
    </html>
    EndHTML
    exit(0);
    Thanks in advance
    Jules1777

    Originally Posted by gregd06082
    Hello-
    I am a newbie and I have created a form that is to be filled out and submitted upon completion. I have yet to figure out workflow so that it actually works but in the meantime I have added a user list where the user can type the name of the person that the form needs to go to next. When I add the person's name in this field and click OK to submit, she does not get notified. Not sure what I am doing wrong.
    Greg
    You have to set up a workflow notification when defining your workflow. Check out the Novell Vibe Advanced User Guide about workflows: Novell Doc: Novell Vibe 3.3 Advanced User Guide - Creating a Simple Workflow
    HTH
    Erik

  • Job ab Ende November gesucht...

    Auch ohne Hoch- oder Fachschulabschluß sind Spitzenleistungen drin!
    Suche nach Abschluß meiner Ausbildung zur IT-Managerin/Neue Medien interessanten Job.
    Kenntnisse:
    - HTML, JavaScript, CSS, Photoshop, Premiere, Illustrator, SoundForge, Flash4, Dreamweaver, HomeSite.
    Interessen:
    - WebDesign, Programmierung.
    mfG
    [email protected]

    Hier Javascript:
    Postmail-CGI
    Hallo,
    Könnten Sie helfen, wie man ein Postmail-CGI richtig installiert ? Mein Hoster hat mir vor Vertragsabschluß versprochen, mir beim Installieren eines Postmail-CGI zu helfen - und daß dies kein Problem wäre. Nun allerdings scheint er damit auch Probleme zu haben. Das CGI läuft offenbar, denn nach Absenden bringt es im Browser die Rückmeldung "ihre Eingaben waren korrekt... etc." allerdings kommt im Emailpostfach keiene Email an.
    Könnten Sie helfen ? Offenbar fehlt nur ein richtiger Eintrag im CGI, der die Mail in das Postfach leitet.
    Das Problem: vermutlich die richtigen urls im CGI anzugeben. Es handelt sich um einen
    Apache Server. Das CGI befindet sich im Verzeichnis der Website im cgi-bin. Das CGI heißt
    af.cgi. Zur besseren Orientierung dasselbe nachfolgend:
    #!/usr/bin/perl
    # AlienForm2 - Released 23 May, 1998.
    # Copyright 1997, 1998 Jon Hedley - [email protected]
    # All Rights Reserved.
    # Do not discribute this script without my express, written permission!
    # Remember to upload in ASCII mode!
    # Work hard, and be good to your mother.
    # Deutsche Übersetzung:
    # www.internet-partner.de mail: [email protected]
    # Beachte, daß das Script im ASCII Modus upgeloadet wird !
    # Installationhilfen können gegeben werden, bitte Kontakt per eMail oder AIM
    # Wir freuen uns auf jeden Link auf unsere Homepage, machen es aber nicht zur
    # Bedingung
    # Setzt den benötigten MIME-Type. Normalerweise sollte hier nichts geändert werden.
    $content_type = "Content-Type: text/htmlnn";
    # Hier den Unix-Pfad zu den Forumularen angeben. Dieser Pfad wird den angegebenen
    # Formularen vorangestellt. Das Verzeichnis sollte dort sein, wo sich auch die HTML-Dateien
    # befinden, nicht aber im CGI-BIN Verzeichnis, bzw. in dortigen Unterverzeichnissen!
    $base_path = \'/vserv/i/interne2/htdocs/formulare/\';
    # Befehl zum laden des Mailers, welcher unbedingt den STDIN-Standard unterstützen sollte!
    $mail_cmd = \'/usr/sbin/sendmail -t\';
    # Hier kann festgeelgt werden, welcher Server, oder welche Seiten auf dieses
    # Script zugreifen darf. Dabei können ganze URL\'s angegeben werden oder auch
    # global ganze Server (ist meist das sinnvollste). Es ist sinnvoll die Angaben
    # mit UND ohne vorangestelltem www zu machen. Es sei denn, der Server ist sowieso
    # nicht erreichbar ohne www. vorweg.
    # Alternativ kann hier auch eine IP angegeben werden. Alle Einträge sind in \' Hochkommas \'
    # zu setzen, und werden in einer Liste mit Kommas getrennt.
    @Referers = (\'www.domainnahme.com\');
    ##Hier habe ich den richtigen Domainnahmen angegeben.
    ## AB HIER NICHTS MEHR ÄNDERN, WENN DU NICHT GENAU WEISST ##
    ## WAS DU MACHST! ##
    $error_loop = 0;
    $browser_out = 0;
    if ($ENV{\'REQUEST_METHOD\'} eq \'GET\' and not $ENV{\'QUERY_STRING\'})
    $ENV{\'OUT_TITLE\'} = "AlienForm2 deutsch Releas 9/98";
    $ENV{\'OUT_MSG\'} = qq|Die letzte deutsche Version ist erhaeltlich bei <a href="http://www.internet-partner.de">Internet-Partner.de.|;
    @msg = (<DATA>);
    @msg = ParseText(@msg);
    BrowserOut(@msg);
    exit(0);
    &CheckRef;
    &ParseForm;
    if (@missing_values or @bad_emails or @only_digits or @only_words) { Error(\'evil values\') }
    foreach $key (keys %FORM)
    if ($key =~ /^_send_email/)
    @lines = ReadFile(\'Email Template\',$FORM{$key});
    @lines = ParseText(@lines);
    SendMail(@lines);
    elsif ($key =~ /^_out_file/)
    @lines = ReadFile(\'Log File\',$FORM{$key});
    @lines = ParseText(@lines);
    LogFile(\'LogFile Template\',@lines);
    elsif ($key =~ /^_browser_out/ and $browser_out < 2)
    $browser_out++;
    @lines = ReadFile(\'Browser Template\',$FORM{$key});
    @lines = ParseText(@lines);
    BrowserOut(@lines);
    elsif ($key =~ /^_redirect/ and $browser_out < 2)
    $browser_out++;
    print "Location: $FORM{$key}nn";
    unless ($browser_out)
    @msg = (<DATA>);
    $ENV{\'OUT_TITLE\'} = "Übertragung erfolgreich";
    $ENV{\'OUT_MSG\'} = "Deine eingaben waren erfolgreich, vielen Dank";
    @msg = ParseText(@msg);
    BrowserOut(@msg);
    exit(0);
    sub BrowserOut
    { print "$content_type@_n" }
    sub CheckRef
    my ($valid_referer, @terms);
    if ((@Referers) and ($ENV{\'HTTP_REFERER\'}))
    foreach $referer (@Referers)
    if ($ENV{\'HTTP_REFERER\'} =~ m|http.*?://$referer|i)
    $valid_referer++;
    last;
    else {$valid_referer++;}
    unless ($valid_referer)
    @terms = split(///,$ENV{\'HTTP_REFERER\'});
    Error
    \'Falscher Server\',
    "\'$ENV{\'HTTP_REFERER\'}\' ist nicht autorisiert zur Verwendung des Scripts. Wenn du eine Erlaubnis geben möchtest,
    trage bitte \'$terms[2]\' in die reffer-liste am Anfang des Scripts."
    sub Error
    ++$error_loop;
    my $title = shift @_;
    my $msg = shift @_;
    my @error;
    if ($title eq \'evil values\')
    my $val;
    if (@missing_values)
    $msg = qq|<p>Die nachfolgenden Felder müssen eingegeben werden:</p>n<ol type="i">n|;
    foreach $val (@missing_values) { $msg .= "<li>$valn" }
    $msg .= "</ol>n";
    if (@bad_emails)
    $msg .= qq|<p>Die nachfolgenden Felder müssen eine gültige eMail-Adresse beinhalten:</p>n<ol type="i">n|;
    foreach $val (@bad_emails) { $msg .= "<li>$valn" }
    $msg .= "</ol>n";
    if (@only_digits)
    $msg .= qq|<p>Die nachfolgenden Felder dürfen nur Zahlen von (0-9) enthalten:</p>n<ol type="i">n|;
    foreach $val (@only_digits) { $msg .= "<li>$valn" }
    $msg .= "</ol>n";
    if (@only_words)
    $msg .= qq|<p>Die nachfolgenden Felder dürfen keine Sonderzeichen enthalten, nur A-Z und 0-9:</p>n<ol type="i">n|;
    foreach $val (@only_words) { $msg .= "<li>$valn" }
    $msg .= "</ol>n";
    $title = \'Fehler - Fehlerhafte Zahlen\';
    $msg .= qq|<p>Gehe zurück und wiederhole die Eingabe.</p>n|;
    if ($FORM{\'_error_url\'}) { print "Location: $FORM{\'_error_url\'}nn" }
    elsif ($FORM{\'_error_path\'} and $error_loop < 2)
    $ENV{\'OUT_TITLE\'} = $title;
    $ENV{\'OUT_MSG\'} = $msg;
    @error = ReadFile(\'Error Template\',$FORM{\'_error_path\'});
    @error = ParseText(@error);
    BrowserOut(@error);
    else
    @error = (<DATA>);
    $ENV{\'OUT_TITLE\'} = $title;
    $ENV{\'OUT_MSG\'} = $msg;
    @error = ParseText(@error);
    BrowserOut(@error);
    exit(0);
    sub LogFile
    my $msg = shift @_;
    my $file = shift @_;
    $file = $base_path . $file;
    open(FILE,">>$file") or Error(\'Datei Zugriffs Fehler\',"Ein Fehler tritt auf, beim anhängen an die Log-Datei $msg ($file): $!");
    flock(FILE,2) or Error(\'Datei Sperr Fehler\',"Ein Fehler tritt bei der Dateispere auf: $msg ($file): $!.");
    print FILE @_;
    close(FILE) or Error(\'Datei schlißen Fehler\',"Ein Fehler tritt beim Schliessen der Datei auf: $msg ($file): $!.");
    sub ReadFile
    my $msg = shift @_;
    my $file = shift @_;
    my @lines;
    $file = $base_path . $file;
    open(FILE, "$file") or Error(\'Datei Zugriffs Fehler\',"Ein Fehler tritt beim Zugriff auf: $msg ($file): $!.");
    flock(FILE,2) or Error(\'Datei Lock Fehler\',"Ein Fehler tritt beim sperren auf: $msg ($file): $!.");
    @lines = (<FILE>);
    close(FILE) or Error(\'Datei Schliessen Fehler\',"Ein Fehler tritt beim Schliessen der Datei auf: $msg ($file): $!.");
    return @lines;
    sub ParseForm
    my ($key, $prefs, $buffer);
    if ($ENV{\'REQUEST_METHOD\'} eq \'GET\')
    { @pairs = split(/&/, $ENV{\'QUERY_STRING\'}) }
    elsif ($ENV{\'REQUEST_METHOD\'} eq \'POST\')
    read(STDIN, $buffer, $ENV{\'CONTENT_LENGTH\'});
    @pairs = split(/&/, $buffer)
    else {Error(\'Bad or Unbekannte Request-Methode\',
    "Das Formular muß mit REQUEST=POST oder REQUEST=GET übertragen werden, Fehler in HTML-Datei prüfen!.")}
    foreach $pair (@pairs)
    local($name, $value) = split(/=/, $pair);
    $name =~ tr/+/ /;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/<!--(.)*?-->//mg;
    $FORM{$name} = $value;
    if ($name =~ /_/ and $name !~ /^_/)
    ($prefs, $key) = split /_/, $name, 2;
    if ($prefs =~ /r/i and not $value) { push @missing_values, $key }
    if ($prefs =~ /e/i and $value and
    (($value =~ /(@.*@)|(..)|(@.)|(.@)|(^.)/) or
    ($value !~ /^.+@([?)[a-zA-Z0-9-.]+.([a-zA-Z]{2,3}|[0-9]{1,3})(]?)$/)))
    { push @bad_emails, $key }
    if ($prefs =~ /d/i and $value and $value =~ /D/) { push @only_digits, $key }
    if ($prefs =~ /w/i and $value and $value =~ /W/) { push @only_words, $key }
    if ($prefs =~ /s/i and $value) { $value =~ s/^(s)*//;
    $value =~ s/(s)*$//;
    $FORM{$name} = $value; }
    sub ParseText
    my ($line, $key, $value, $sub);
    foreach $line (@_)
    while (($key => $value) = each %FORM)
    { $line =~ s/[$key]/$value/ig }
    while (($key => $value) = each %ENV)
    { $line =~ s/[%$key]/$value/ig }
    $line =~ s/[[^<](.)*?[^>]]//g;
    foreach $line (@_)
    while ($line =~ /[<((.)*?)>]/)
    $sub = $1;
    $sub =~ s/[^d+*/-%.x<>()]//g;
    $sub = eval $sub;
    $line =~ s/[<(.)*?>]/$sub/
    return @_;
    sub SendMail
    open(MAIL,"|$mail_cmd") or Error(\'Fehler - Mailer öffnen\',"Ein Fehler tritt auf beim Starten des Mailers ($mail_cmd): $!.");
    print MAIL @_;
    close(MAIL) or Error(\'Mail Send Error\',"Ein Fehler tritt beim Senden der eMail auf: $?. Please check the email\'s headers.");
    __END__
    <head>
    <title>[%OUT_TITLE]</title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
    <div align="center"><center>
    <table border="2" cellpadding="0" cellspacing="0" bgcolor="#FFD26B" bordercolor="#699A69"
    width="500">
    <tr>
    <td><h2 align="center">[%OUT_TITLE]</h2>
    <p align="center">[%OUT_MSG]</p></td>
    </tr>
    </table>
    <p><br><p>
    <table border="2" cellpadding="0" cellspacing="0" bgcolor="#FFD26B" bordercolor="#699A69"
    width="500">
    <tr>
    <td><h2 align="center"><a href="http://www.cgi.tj/">AlienForm<sup>2</sup></a></h2>
    <p align="center">Copyright 1997 - 1998 <a href="mailto:[email protected]">Jon Hedley</a>.<br>
    All Rights Reserved.<br><br>Deutsche Übersetzung: <a href=http://www.internet-partner.de>www.internet-partner.de</a><br>
    eMail <a href=mailto:[email protected]>[email protected]</a></b><br></td>
    </tr>
    </table>
    </center></div>
    </body>
    Im HTML-Text ist folgende Zeile eingetragen:
    <form name="FormName#5" action="cgi-bin/af.cgi" method="post">
    welche vielleicht noch nicht richtig ist.
    Zunächst habe ich mir mit folgender Zeile beholfen:
    <form name="Formular 1" action="mailto:[email protected]" method="post" enctype="text/plain" target="_self">
    Diese bedient das Formular ohne CGI-Funktion, soll aber nicht mit allen Browsern bzw. Servern funktionierne - und vor allem, es fehlt die Rückmeldung.
    Die im CGI verzeichnete Firma Schiffmann meldet sich auch nicht auf eine Anfrage, obwohl Sie Hilfe beim Installieren versprochen hat, es kommt lediglich eine automatische mailantwort mit Angeboten.
    Verschiedene Anbieter im internet machen ebenfalls Angebote, ihren Mailserver gegen Entgeld zu benutzen (was ja nicht verwerflich ist).
    Die NCSA HTTPd ( cgi-src directory) bietet Beispiel CGI, die ich im Moment leider nicht entpacken kann, da ich erst Stuffit-Deluxe kaufen müßte
    Wenn ich hoffentlich bald mehr Kunden habe, könnte ich Partner und Mitarbeiter gebrauchen.
    Mit freundlichen Grüßen
    Uwe Hamisch
    Hanau

  • What is the diffrence between java run time env and JVM ?

    I wrote an applet on computer that installed run time env J2SE 1.4 that is running ok.
    when i try to run the applet on diffrent mechine that has earlier version my applet didn't run ok.
    Isn't enught just to install JVM ?

    The target mechine requirements should be more then
    only JVM installed ?
    do I have to ask for updated Run Time Env installed
    also ?Yes, you have to. If your program has been developed taking advantage of a certain version of the JRE, then all people using your program must have at least that version of the JRE.

  • Issue with LCM while migrating planning application in the cluster Env.

    Hi,
    Having issues with LCM while migrating the planning application in the cluster Env. In LCM we get below error and the application is up and running. Please let me know if anyone else has faced the same issue before in cluster environment. We have done migration using LCM on the single server and it works fine. It just that the cluster environment is an issue.
    Error on Shared Service screen:
    Post execution failed for - WebPlugin.importArtifacts.doImport. Unable to connect to "ApplicationName", ensure that the application is up and running.
    Error on network:
    “java.net.SocketTimeoutException: Read timed out”
    ERROR - Zip error. The exception is -
    java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)

    Hi,
    First of all, if your environment for source and target are same then you will have all the users and groups in shared services, in that case you just have to provision the users for this new application so that your security will get migrated when you migrate the from the source application. If the environs are different, then you have to migrate the users and groups first and provision them before importing the security using LCM.
    Coming back to the process of importing the artifacts in the target application using LCM, you have to place the migrated file in the @admin native directory in Oracle/Middleware/epmsystem1.
    Open shared services console->File system and you will see the your file name under that.
    Select the file and you will see all your exported artifacts. Select all if you want to do complete migration to target.
    Follow the steps, select the target application to which you want to migrate and execute migration.
    Open the application and you will see all your artifacts migrated to the target.
    If you face any error during migration it will be seen in the migration report..
    Thanks,
    Sourabh

  • Cancel Save Workflow option missing in R17 env

    Has anyone noticed the cancel save option in WF is missing in my R17 env.
    Can anyone confirm if they have it in any of their R17 env ?
    Edited by: Robin7511 on Jun 15, 2010 3:32 PM

    Hi Everyone,
    We were a little surprised by this as well. We had built quite a few CO validations with it and at this time will probably rollback the validations until certification is complete.
    The following is an excerpt taken directly from the June 2010 patch release notes:
    Oracle CRM On Demand
    Release 17
    Patch Release Notes
    1142.0.02
    "Cancel Save option in Workflow exposed on record types other than Opportunity (CR 12-1XVXFX5)
    The Cancel Save feature was released in 1083.0.00 for the Opportunity record type only. It was
    inadvertently exposed on other record types and is not certified by Oracle CRM On Demand. If you
    have already used this feature you will receive the following privilege so you can either roll back the
    use of this feature (recommended) or continue usage at your own risk:
    Privilege Category: Customization: Business Rules
    Privilege Name: Workflow Cancel Save
    Privilege Description: Prevent save operation on 'Before Modified Record Saved' workflow events.
    This privilege is dependent on the Manage Data Rules - Manage Workflow Rules privilege. The
    privilege allows the use of this feature on the following record types:
    1. Account
    2. Activity
    3. Contact
    4. Custom Object 1
    5. Custom Object 2
    6. Custom Object 4
    7. Household
    8. Lead
    9. Revenue
    10. Service Request
    This feature is not supported on any other record types.
    If you have used the Cancel Save feature, and have not received this privilege or the privilege is inactive, the Cancel
    Save section for the above record types:
    - is not visible in the workflow creation page
    - is read-only in the workflow edit and detail pages
    Customers who have not yet used this feature may use it on the Opportunity record type only which is not
    restricted by the above privilege and is certified for all customers.
    Certification of this feature for the record types listed above is currently underway and will be available in a
    forthcoming release."
    ~Jennifer~

  • The DbEnv memery missing in win7 x64(may be a berkeley'Env bug in x64)

    I am a newer programer in Berkeley,this is my first use it.
    I create a BDB for png image, about 40gb, the key is used ACE_UINT64, the value is ACE_Message_Block.
    I used LoadRunner create 100 user to get the image by my program.
    It is correctly in win7 32bit, but it is lost memory in 64bit.
    I open the Env with DB_Private | DB_init_pool | DB_thread, and set the cachesize to 1gb, also the DBt of value is set_flags(DB_DBT_MALLOC), also use free(DBt.getdata()).
    My server thread's commit memory in taskmgr.exe is keep at 1gb, but the memory in used of system increase never stop, at last all of memey has been used, and my server thread stop at berkeleydb.
    I find my used memory is 8gb, my system+loadruner+vs2008 at most 1.5gb, and my server thread keep in 1gb, what the other memory who used?
    So I shut down the server thread, all memory came back.
    So I change Berkeley DB Storage to Read my image.png direct in file system, the memory is correctly.
    So must some wrong in my code to used berkeleydb, must in DBt’ alloc,so how can i free the memory in x64?
    So I need helper, what’s the wrong with my DBEnv?How can I free the DBt in 64 bit?
    int IMG_Storage_Environment::Initialize( ISF_Profile_Visitor & Profile )
         Env = new DbEnv( 0 );
         int env_flags = DB_CREATE | // If the environment does not exist, create it
              DB_PRIVATE |
              DB_INIT_MPOOL | // Initialize the cache
              DB_THREAD ; // Free-thread the env handle
         if ( Env->set_cachesize( 1, 0, 1) == 0 &&     Env->open( NULL, env_flags, 0 ) == 0 )
              return ERR_SUCCESS;
    int IMG_Storage_BerkeleyDB::Initialize( ACE_StrItrT Layer , ACE_StrItrT Path )
         this->db = new Db( IMG_Storage_Environment::Instance()->getDbEnv(), 0 );
         if (
              0 == db->open( NULL, STR_T2A( Path ) , NULL ,DB_UNKNOWN, DB_RDONLY ,NULL)
              ISF_DEBUG( "Open DB: %s Succeed" , Path );
              return ERR_SUCCESS;
    int IMG_Storage_BerkeleyDB::GetTile( int x , int y , int z , ACE_Message_Block & Data )
         ACE_UINT64 uKey=this->Key( x, y, z);
         Dbt dbKey(&uKey, sizeof(uKey));
         Dbt dbData;
         dbData.set_flags( DB_DBT_MALLOC );
         int err = db->get(NULL, & dbKey, & dbData, 0);
         if ( 0 == err )
              Data.size( dbData.get_size( ) );
              Data.rd_ptr( Data.base( ) );
              Data.wr_ptr( dbData.get_size( ) );
              ACE_OS::memcpy( Data.rd_ptr( ) , dbData.get_data( ) , dbData.get_size( ) );
         else
              ISF_DEBUG( "Image Not exist, Using Empty Image" , err );
         free(dbData.get_data());
         return ERR_SUCCESS;
    Edited by: 886522 on 2011-9-21 上午1:31
    Edited by: 886522 on 2011-9-21 上午1:39

    I encounter the same problem, although I run Berkeley DB (Ver 6.0.20, C#) under .NET Framework and Windows server 2008(x64). Any BDB application of win32 runs well but will encounter trouble under platform of x64 when compile BDB to x64, even though the DLL compiled and linked with win32. The bug is that Berkeley DB take amount of memory as the size of databases and regardless of cacheSize. My estimation is that all memory for BDB malloced and NOT freed.

  • How to configure ENV and DB for multithreaded application?

    Hi,
    From document, I know DB_THREAD must be checked for both ENV and DB, but , I don't know which one is best choice for multithreaded application while facing DB_INIT_LOCK and DB_INIT_CDB. In my application, there maybe multi readers and writers at the same time, should I use DB_INIT_LOCK instead of DB_INIT_CDB? what other flags should I use?
    DB_INIT_CDB provides multiple reader/single writer access while DB_INIT_LOCK should be used when multiple processes or threads are going to be reading and writing a Berkeley DB database.
    Thanks for your seggestions and answers.

    Thanks for the explanation,
    The Berkeley DB Concurrent Data Store product
    allows for multiple reader/single writer access
    to a database. This means that at any point in time,
    there may be either multiple readers accessing a
    database or a single writer updating the database.
    Berkeley DB Concurrent Data Store is intended for
    applications that need support for concurrent updates
    to a database that is largely used for reading.
    If you are looking to support multiple readers and
    multiple writers then take a look at the Transactional
    Data Store product
    (http://download.oracle.com/docs/cd/E17076_02/html/programmer_reference/transapp.html)
    In this case the Environment is typically opened with:
    DB_INIT_MPOOL, DB_INIT_LOCK, DB_INIT_LOG, and DB_INIT_TXN.
    Let me know if I missed any of your question.
    Thanks,
    Sandra

  • How to move the script from one env to another

    Hi
    I have a database where i have two schemas.
    1)Owner and 2) User . User schema contains all synonyms for the objects present in Owner schema and the application will connect to user schema only.
    Now i have 2 script files 1) create tables in the owner + giving grant access for user 2 ) create synonyms for objects in the owner
    I have to move the code from Dev environment to QA . For QA i dont have privileges hence have to give the script file to DBA to run it
    My DBA says....give the scripts through clearcase. only 2 script files should be there and environment information should not be hardcoded. i.e
    for statements in the script file like : grant access for <table_name> to USERSCHEMANAME and create synonym <table_name_alisa> for OWNERschemaNAME.table_name
    how do i give the scripts to my DBA with out hardcodiing.    How do you have this code movement in your project ?
    Should i use any placeholder for OWNERNAME ( environment spefcific informationn) and should ask them to replace it by the corresponding env name while executing
    What should i do?
    Hope i am clear please let me know if iam not clear
    regards
    raj

    how do i give the scripts to my DBA with out hardcodiing. How do you have this code movement in your project ?
    Should i use any placeholder for OWNERNAME ( environment spefcific informationn) and should ask them to replace it by the> corresponding env name while executing
    Use a variable for schema names or create public synonyms.
    And document how the DBA should implement your changes.
    Your DBA should have his own "su'ish"/ "@ conn.sql'-ish" scripts for that.
    Passwords can be reset runtime temporarily, and set back after the implementation completed successfully.

Maybe you are looking for

  • How can I run a script from path?

    Hi all How can a illustrator script be run from a path by double clicking the script file not from illustrator menu->scripts. thanks in advance THAMIL

  • Printing quality problem with Photosmart D110

    The printing quality is very bad after we changed the catridge. The printer keeps saying that there is catridge jam. But after I followed the steps by the printer, the problem is still unsolved. What is the possible reason and how could I solve it?

  • SQL query using equal or not equal to

    Hi All; In my below query i need to display i need to display clients with output = Start on Scheme post but output should be equal to Pre- Start Assist or Business Assist ( any one  or both output should not be there) Only display those records Any

  • Server performance with beans in WEB-INF/classes

    Hi, Someone over at oracle corp told me that if i put my beans in WEB-INF/classes, my server would notice a significant performance degradation since the beans would be automatically refreshed or dynamically loaded everytime. WHat I am doing now is r

  • OFFICE JET PRO 8600 ALL IN ONE N911A -

    I HAVE HAD THE PRINTER FOR ABOUT 1 MONTH AND TODAY WILL NOT PRINT - MESSAGE COMES UP SAYS "MISSING OR FAILED PRINT HEAD - CYAN/MAGENTA/YELLOW/BLACK" .  I FOLLOWED THE DIRECTIONS BY TURNING  IT OFF / ON  AND REINSTALLING PRINTHEAD. I STILL GET THE SAM