Jump to content
xisto Community
Sign in to follow this  
Trystim

Anyone Know CGI/Perl i need help please?

Recommended Posts

If anyone knows cgi/perl would like to contact me and help with a simple send mail problem lol *cuz i have no clue* please feel free or post here but messenger probably betteryahoo is p00l_dem0n77msn is p00l_dem0n77@hotmail.comicq is 255-051-386)thanks in advance

Share this post


Link to post
Share on other sites
#!/usr/local/bin/perl[br]# NOTE- on above line- your path to PERL could be different![/br]# If you're not sure, check with your web host.[br]# NOTE- again, your path to sendmail could be different[/br]$mailprog = "/usr/lib/sendmail";[br]# NOTE- this is where you want the email sent to.[/br]# Be sure and "escape" the "@" sign.[br]$recipient = "sitemail@timsmed.com";[/br]# get the input[br]# put it in $buffer[/br]read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});[br]# split the input into name-value pairs[/br]@pairs = split(/&/, $buffer);[br]# standard processing loop[/br]# this will un-URLencode as many variables as you send and place[br]# in an array ($FORM).[/br]foreach $pair (@pairs) {[br] # split the name-value pair into name and value[/br] ($name, $value) = split(/=/, $pair);[br] # convert '+' to space[/br] $value =~ tr/\+/ /;[br] # convert embedded comma to space delimiting purposes[/br] $value =~ tr/\,/ /;[br] # convert hex symbols to alphanumeric[/br] $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c", hex($1))/ge;[br] $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c", hex($1))/ge;[/br] $value =~ s/<!--(.|\n)*-->//g;[br] # create new array with each name and value as elements[/br] $FORM{$name} = $value;[br]}[/br]# now assign a variable name to each value from the input array[br]$NAME = $FORM{'name'};[/br]$EMAIL = $FORM{'email'};[br]$SUBJECT = "Web Site Inquiry";[/br]$MESSAGE = $FORM{'message'};[br]# next we have to re-URLencode any values being sent back to flash.[/br]# for my contact form I'm only going to send the name.[br]$NAME =~ tr/ /\+ /;[/br]# this assigns a "name" to our name/value pair being sent[br]# and sends it back to flash through the standard output stream.[/br]# be sure and note the content type![br]print "Content-type: application/x-www-urlform-encoded\n\n";[/br]print  "rtn_name=$NAME";[br]# now we open a stream to "sendmail" and send the email[/br]# using the variables from above.[br]open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";[/br]print MAIL "To: $recipient\n";[br]print MAIL "From:$EMAIL\n";[/br]print MAIL "Subject: $SUBJECT\n";[br]print MAIL "------------------------------------------------------\n";[/br]print MAIL "$MESSAGE\n\n";[br]print MAIL "$NAME\n";[/br]close (MAIL);[br]exit;
[/br]
that is my perl code that i have in my cgi folder.

here is the form that wont send or submit done in flash
form for submit
and you can download the fla here appx 2 megs
Righ Click Save As

that is about as specific as i can get. Let me know if you have an questions.

Share this post


Link to post
Share on other sites

1st line (path to perl) should be:#!/usr/bin/perlpath to sendmail should be:$mailprog = "/usr/sbin/sendmail";(At least the above is true for my account.. I assume yours would be the same. It would only be different if our accounts resided on different servers. This info can be found in your cpanel).Make sure $recipient = your email addressmake sure the file is chmodded to 755 in the cgi bin.Sorry, I cannot open the fla file here. I don't have flash installed on my system. Would you be able to give me a mock-up html form i could i could see?One thing that you could look for is ACTION of the form contains the url of this file, and the method = POST.. like this:<form ACTION="http://forums.xisto.com/no_longer_exists/; method="POST">(mailprog.cgi of course should be replaced by the name of this file).If that doesn't work try method="GET"

Share this post


Link to post
Share on other sites

Well i fixed the 2 lines you said about correcting you can find the html and swf version at the following locations.
http://forums.xisto.com/no_longer_exists/
http://forums.xisto.com/no_longer_exists/
i still get an error not sure as to why so i contacted the sites customer support because i am at ends with this :) but thanks for your help riao those 2 lines did need changed.

Share this post


Link to post
Share on other sites

The html page doesn't really do me much good as all it does is insert the .swf file. It doesn't show how it sends the data to the mail prog. That is in the swf file that I cannot open.What is the error you are getting? Did you CHMOD the file to 755 after putting it in your cgi folder?If you want I could send you a working mailscript. It won't be a flash file, but I could make it operate the was this one is supposed to. I would just need to know what email address you would want the form data sent to.What's more is if you know how to set up a simple html form, you can set up others as well with no changes made to the cgi script.

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.