Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Cgi Files?


6 replies to this topic

#1 spy_charly

    Premium Member

  • Kontributors
  • PipPipPipPipPipPipPipPip
  • 195 posts

Posted 02 April 2006 - 06:20 AM

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?

Quote

#!/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";
}


#2 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 02 April 2006 - 06:33 AM

Simply the answer is yes. It makes calling your script easier. However, if I'm not mistaken you're trying to send information over the email using form?

There's built-in script called cgimail and you can find a short tutorial here: How To Use Trap17 Cgi Formmail

#3 spy_charly

    Premium Member

  • Kontributors
  • PipPipPipPipPipPipPipPip
  • 195 posts

Posted 03 April 2006 - 02:57 AM

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 you

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?

Edited by spy_charly, 03 April 2006 - 04:07 AM.


#4 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 03 April 2006 - 05:28 AM

View Postspy_charly, on Apr 2 2006, 10:57 PM, said:

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.

#5 gaea

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 206 posts
  • Location:Vermont or Boston (USA)
  • myCENT:54.10

Posted 03 April 2006 - 07:00 AM

View Postspy_charly, on Apr 3 2006, 02:57 AM, said:

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.

#6 tuddy

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 570 posts
  • Location:Ballarat
  • Interests:AAFC (Australian Air Force Cadets)<br />Computers

Posted 03 April 2006 - 10:18 AM

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?

#7 spy_charly

    Premium Member

  • Kontributors
  • PipPipPipPipPipPipPipPip
  • 195 posts

Posted 03 April 2006 - 08:57 PM

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...




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users