Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > if condition error

Reply
Thread Tools

if condition error

 
 
David Sudjiman
Guest
Posts: n/a
 
      03-17-2006
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
http://www.velocityreviews.com/forums/(E-Mail Removed) 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:retty 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('keterangan');
my $request_method = $ENV{'REQUEST_METHOD'};
my $remote_address = $ENV{'REMOTE_ADDR'};
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("Title HERE!");
print $cgi -> param('email'), "<br/>";
print $cgi -> param('milis'), "<br/>";
print $cgi -> param('keterangan'), "<br/>";
print $cgi -> end_html();

open (MAIL, "| $mail");
print MAIL "$remote_address \n $data\n\n";
close (MAIL);
}
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      03-17-2006
David Sudjiman wrote:
[...]
> validation. it seems it does not want to match it. For example, i
> give the real (E-Mail Removed) for mail_from it works. But if I give 123,
> the web page turns error 500 internal error. Please advice.


Did you check "perldoc -q 500"?

jue


 
Reply With Quote
 
 
 
 
David Sudjiman
Guest
Posts: n/a
 
      03-18-2006
Jürgen Exner wrote:
> Did you check "perldoc -q 500"?


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

http://www.davidsudjiman.info
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with while condition OR condition Bill W. Ruby 13 05-09-2011 09:42 PM
Condition outside loop or separate loop for different condition? - Java 12 06-15-2005 08:50 AM
threading.py Condition wait overflow error Mark English Python 0 01-25-2005 01:02 PM
Error ID=0x00D199, Condition ID=0000000 =?Utf-8?B?TWljcm9ndXk=?= Microsoft Certification 0 04-14-2004 07:11 PM
Getting error condition from MySQLdb Derek Fountain Python 2 11-04-2003 02:28 AM



Advertisments