Jump to content
xisto Community
Sign in to follow this  
spy_charly

Cgi Files? where does this script belong?

Recommended Posts

hello guys, it's been a couple of days that i dont know where this script must be placed and in which format...i know it is from perl but what format should i use .pl or .cgi, yep i am a newbie :angry:

i also saw that there is a folder in my directory called cgi-bin, do i have tu put it there?

#!/usr/bin/perl
$recipient = "me@somemail.com"; # watch out for backslash
$mail = "/usr/sbin/sendmail";

if($ENV{REQUEST_METHOD} eq 'POST')
{ read STDIN, $buffer, $ENV{CONTENT_LENGTH};
}
else
{ $buffer = $ENV{QUERY_STRING};
}
foreach $pair (split /&/, $buffer)
{ ($key, $value) = split /=/, $pair, 2;
$value =~tr/+/ /;
$value =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/eg;
$FORM{$key} = $value;
}
## special treatment for the comments field
$FORM{comments} =~s/rn?/n/sg;
## here comes your form
open MAIL, "|$mail $recipient";
print MAIL <<END;
From: webserver@yoursite.com
Subject: Contact Form

Contact form filled by
$FORM{name}
$FORM{address}
phone: $FORM{phone}
fax: $FORM{fax}

Comments: $FORM{comments}
END
if(!close MAIL) {
print "(anti-spam-content-type:) text/htmlnn";
print "status=fail&error=Your+mail+could+not+be+sent";
}
else
{ print "(anti-spam-content-type:) text/htmlnn";
print "status=ok";
}


Share this post


Link to post
Share on other sites

thanx boss, actually i was trying to send the Receipent from flash and i thought that using another script it could be possible...But what you provided seems to be very helpful, btw i set a serach on the forum for that topic but i didnt find anything, i guess i will have to be very careful next time... and if i get it working i will show it to youEDITED: i got it working boss, but when it arrives at the mail it arrives like "myname@gamma.xisto.com" is there anyway i can solv this? replacing the account name with my name?

Edited by spy_charly (see edit history)

Share this post


Link to post
Share on other sites

but when it arrives at the mail it arrives like "myname@gamma.xisto.com" is there anyway i can solv this?

Well that's better than myname@someusinversity.department.edu before... :angry:
If you are the only recipient to submitted email then I guess it really does not matter. However, since the mail service is through gamma.xisto.com and our hosting server's name is gamma, I personally do not have the control over that.

I would suggest you contact OpaQue or send queries to Helpdesk (xisto.com/helpdesk) and see if there's a way of doing it.

Share this post


Link to post
Share on other sites

EDITED: i got it working boss, but when it arrives at the mail it arrives like "myname@gamma.xisto.com" is there anyway i can solv this? replacing the account name with my name?

The is the default mailserver. If you it's displaying as that the "from" field in your script is probably misformatted.

Share this post


Link to post
Share on other sites

Following on from gaea, I have my own question, is it possible to have a code line in there where you can tell the form, which mail server to use and what the email it should be replyed to and if you can put a name instead of an email address?I know you can do it in PHP, but is cgimail that flexible?

Share this post


Link to post
Share on other sites

hi tudy!, i dont think you can do it, since it is already done by the cgi script, i tried downloading it but notepad and nor Dreamweaver could open it...my suggestion anyway would be to download the script manually and set the preferences manually as well...the problem is that i dont know about cgi and that makes more the things more difficult...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.