if condition error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Sudjiman

    if condition error

    Hi,

    I'm using this perl script to get the information from a form and send
    it through email. The problem is when I do an email address validation.
    it seems it does not want to match it. For example, i give the real
    abc@abc.com for mail_from it works. But if I give 123, the web page
    turns error 500 internal error. Please advice.



    #!/usr/bin/perl
    use strict;
    use warnings;

    use CGI;
    use CGI::Pretty qw(:all);

    my $cgi = new CGI;

    my $rcpt_to = "abc\@abc\.com" ;
    my $mail_from = $cgi -> param('email');
    my $subject = $cgi -> param('milis');
    my $data = $cgi -> param('keterang an');
    my $request_method = $ENV{'REQUEST_M ETHOD'};
    my $remote_address = $ENV{'REMOTE_AD DR'};
    my $mail = "/usr/bin/mail -s $subject $rcpt_to";

    if (
    # $mail_from =~ /(@.*@)|(\.\.)|( @\.)|(\.@)|(^\. )/ ||
    # $mail_from !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z0-9]+)(\]?)$/)
    $mail_from == '123'
    ) {
    print "Email Error";
    }
    else {
    print $cgi -> header();
    print $cgi -> start_html("Tit le HERE!");
    print $cgi -> param('email'), "<br/>";
    print $cgi -> param('milis'), "<br/>";
    print $cgi -> param('keterang an'), "<br/>";
    print $cgi -> end_html();

    open (MAIL, "| $mail");
    print MAIL "$remote_addres s \n $data\n\n";
    close (MAIL);
    }
  • Jürgen Exner

    #2
    Re: if condition error

    David Sudjiman wrote:
    [...][color=blue]
    > validation. it seems it does not want to match it. For example, i
    > give the real abc@abc.com for mail_from it works. But if I give 123,
    > the web page turns error 500 internal error. Please advice.[/color]

    Did you check "perldoc -q 500"?

    jue


    Comment

    • David Sudjiman

      #3
      Re: if condition error

      Jürgen Exner wrote:[color=blue]
      > Did you check "perldoc -q 500"?[/color]

      Just another cliche mistake. i need a bit a time of sleep. Check the
      error.log and found out that i forgot to put the header if the condition
      is true.

      "Did you decide to go see a movie?"

      thx
      ..dave


      Comment

      Working...