Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 04-01-2004, 10:02 PM cgi email
dbzguy's Avatar
Ultra Talker

Posts: 345
Location: Artic
Trades: 0
this is annoying!
I tryng to get an email form to work using cgi/perl but i dont know anything about perl so if any body could help my :

#!/usr/bin/perl

# The following accepts the data from the form

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;
}



# The following sends the email

open (MESSAGE,"| /usr/sbin/sendmail -t");

print MESSAGE "To: $FORM{to}\n";

print MESSAGE "From: $FORM{name}/n";
print MESSAGE "Reply-To: $FORM{email)/n";

print MESSAGE "Subject: website email\n\n";
print MESSAGE "Wrote:\n\n";
print MESSAGE "$FORM{body}\n";
close (MESSAGE);

&thank_you;
}




#The following creates the Thank You page display

sub thank_you {

print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Thank You!</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#000000 TEXT=#00ced1>\n";
print "<H1>Thank You!</H1>\n";
print "\n";
print "<P>\n";
print "<H3>I will reply within a week..<BR>\n";
print "<h4>Hope you like my site.</h4>\n";
print "<P>\n";
print "</BODY>\n";
print "</HTML>\n";
exit(0);
}
__________________

Please login or register to view this content. Registration is FREE


PHP Code:
<?PHP if(ping == true) { attackuserip(); } ?>
dbzguy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-03-2004, 06:57 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
What's the problem you're having? Simply upload your script and CHMOD it to 755. Then create a form with the fields to, name, email and body and point it to the script.

Just a note, I would change:
Code:
 print MESSAGE "To: $FORM{to}\n";
to
Code:
 print MESSAGE "To: your\@emailaddress.com\n";
Allowing the 'to' address to be set in the form is very insecure and it is extremely easy for spammers to use your form to send out spam.
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to cgi email
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11317 seconds with 12 queries