By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 2,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

I wan't to lose the HTML reply page, please can you help

P: 9
Firstly this is my first post so thanks in advance for any help.

I have created a form in my web page using Flash and all the variables seem OK. So now I have set up the CGI form on my web server (to respond to the enter button) using Matt Wrights script (I know NMS is better from research but my host demands I use their Matt's formmail script so I am stuck with it).

So my question is I want to lose the the HTML page that pops up when I fill in my form and press the enter button and just have the variables(customer info) returned directly to my e-mail in-box.

As far as I can tell this is something I must fix in the PERL script so if anyone could start of the discussion and start pointing me in the right direction I would appreciate it.

I am newer to PERL than I am to actionscript so if anyone feels I should move this to the Flash section please let me know, but as far as I can make out it's the PERL script that generates the return HTML page so here I am.

I haven't uploaded the site yet because I don't want a form that doesn't return the data.

Any info would be appreciated.

If I can attach any specific code to a reply that would shine light on my problem I'll be glad to.

Thanks again.

Cheers.

D.
Oct 12 '07 #1
Share this Question
Share on Google+
12 Replies


eWish
Expert 100+
P: 971
Does Matt's site offer support for his scripts? That is where I would start.

Before anyone can help you; you will need to post the relevant code where this is being done in the perl script.

When posting code please sue the [code] [ /code] tags. Thanks!
Oct 12 '07 #2

KevinADC
Expert 2.5K+
P: 4,059
Does Matt's site offer support for his scripts? That is where I would start.

Before anyone can help you; you will need to post the relevant code where this is being done in the perl script.

When posting code please sue the [code] [ /code] tags. Thanks!

Matt himself recommends you don't even use his old scripts anymore, let alone support them.
Oct 12 '07 #3

eWish
Expert 100+
P: 971
I agree...I have heard many horror stories about them...
Oct 13 '07 #4

P: 9
Hi, thanks to all for replying to my post so quickly.

I've posted the code after my reply, changing details where appropriate.

I guess I'm having to re-think how I am going to approach my objective.

I suppose my new question would now be, if I want to simply have my flash form results e-mailed directly to my in-box without any HTML what would be the best type of code to use PHP etc. I don't want to change my flash form vastly if possible, but have the variables e-mailed to me.

I have no coding knowledge (other than actionscript) so all suggestions will be welcome and any form of scripting that I could get to complete my objective, but do by myself, would be great.

I've put my current code below in-case anyone can point out how I can fix my problem with what I currently have at hand (not having an HTML page returned when hitting the enter button on my form as well as not receiving the results from the form).

Thanks again for all your help.

P.S. I had to lose the bottom section of the code because it wouldn't let me submit otherwise, if there is a particular section of code I should post please let me know and I will re-post.

D.

Expand|Select|Wrap|Line Numbers
  1.  
  2. #!/usr/bin/perl
  3. ##############################################################################
  4. # FormMail                        Version 1.92                               #
  5. # Copyright 1995-2002 Matt Wright mattw@scriptarchive.com                    #
  6. # Created 06/09/95                Last Modified 04/21/02                     #
  7. # Matt's Script Archive, Inc.:    http://www.scriptarchive.com/              #
  8. ##############################################################################
  9. # COPYRIGHT NOTICE                                                           #
  10. # Copyright 1995-2002 Matthew M. Wright  All Rights Reserved.                #
  11. #                                                                            #
  12. # FormMail may be used and modified free of charge by anyone so long as this #
  13. # copyright notice and the comments above remain intact.  By using this      #
  14. # code you agree to indemnify Matthew M. Wright from any liability that      #
  15. # might arise from its use.                                                  #
  16. #                                                                            #
  17. # Selling the code for this program without prior written consent is         #
  18. # expressly forbidden.  In other words, please ask first before you try and  #
  19. # make money off of my program.                                              #
  20. #                                                                            #
  21. # Obtain permission before redistributing this software over the Internet or #
  22. # in any other medium. In all cases copyright and header must remain intact. #
  23. ##############################################################################
  24. # ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
  25. #                     http://www.securityfocus.com/archive/1/62033           #
  26. ##############################################################################
  27. # Define Variables                                                           #
  28. #      Detailed Information Found In README File.                            #
  29.  
  30. # $mailprog defines the location of your sendmail program on your unix       #
  31. # system. The flags -i and -t should be passed to sendmail in order to       #
  32. # have it ignore single dots on a line and to read message for recipients    #
  33.  
  34. $mailprog = '/usr/lib/sendmail -i -t';
  35.  
  36. # @referers allows forms to be located only on servers which are defined     #
  37. # in this field.  This security fix from the last version which allowed      #
  38. # anyone on any server to use your FormMail script on their web site.        #
  39. #
  40. #@referers = ('scriptarchive.com','209.196.21.3');
  41. #
  42. @referers = qw('mywebsite.co.uk','www.mywebsite.co.uk', localhost);
  43.  
  44. # @recipients defines the e-mail addresses or domain names that e-mail can   #
  45. # be sent to.  This must be filled in correctly to prevent SPAM and allow    #
  46. # valid addresses to receive e-mail.  Read the documentation to find out how #
  47. # this variable works!!!  It is EXTREMELY IMPORTANT. 
  48.                         #
  49. @recipients = qw('myname@myhost.co.uk', localhost);
  50.  
  51. # ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
  52. # @valid_ENV allows the sysadmin to define what environment variables can    #
  53. # be reported via the env_report directive.  This was implemented to fix     #
  54. # the problem reported at http://www.securityfocus.com/bid/1187              #
  55.  
  56. @valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');
  57.  
  58. # Done                                                                       #
  59. ##############################################################################
  60.  
  61.  
Oct 13 '07 #5

eWish
Expert 100+
P: 971
I have done what you are trying to do before. It has been some time ago though.

I used the script below to do this for my brother's site. He did not want to use perl for what ever reason, so we did it in PHP. Nonetheless, here is what I used. If nothing else it will be a good start.


External scripct called contact.php I directed the flash file to look for the external file.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.         $your_name = $_GET ['name'];
  4.     $your_email = $_GET ['email'];
  5.     $your_phone = $_GET ['phone'];
  6.     $your_fax =  $_GET ['fax']; 
  7.         $your_message =  $_GET ['comments'];
  8.  
  9.         $recipient_email = "enter_the_email_address_here_where_you_want_it_sent"; 
  10.  
  11.         $subject = "from" .$your_email;
  12.         $headers = "From:" .$your_name . "<" . $your_email .">\n";
  13.         $headers .= 'content-type: text/html; charset=iso-8859-1';
  14.  
  15.  
  16.         $content = "<html><head><title>Enter Your Site Title Here</title></head><body><br>";
  17.         $content .= "Name: <b>" . $your_name . "</b><br>";
  18.         $content .= "Phone: <b>" . $your_phone . "</b><br>";
  19.         $content .= "E-mail: <b>" . $your_email . "</b><br><hr><br>";
  20.         $content .= $your_message;
  21.         $content .= "<br></body></html>";
  22.  
  23.         mail($recipient_email,$subject,$content,$headers);
  24. ?>                         
  25.  
  26. <html>
  27.  
  28.      <body bgcolor="ffffff">
  29.  
  30.        <div align="center" style="margin-top:60px;color:#000000;font-size:11px;font-family:tahoma;font-weight:bold">
  31.             Your message was sent. Thank you!
  32.  
  33.            </div>
  34.  
  35.          </body>
  36.  
  37.       </html>
  38. <script> resizeTo (300, 300) </script>
Once it was submitted then a popup window 300 x 300 displayed a simple message. Then the flash redirected to the home page. Hopefully something like this will work for you.

I don't know php, so I can not say that there are not some security issues. I do know that he has not had any problems, and it has been about a year now.

If you want to do this in perl the look into use a module like Mail:Sendmail (which is really basic and user friendly. It is bound to be better than what the Matt's script is offering you.

Good Luck!

Note:: Jeff please don't shoot me for posting PHP code:) Thanks!
Oct 13 '07 #6

numberwhun
Expert Mod 2.5K+
P: 3,503
I have done what you are trying to do before. It has been some time ago though.

I used the script below to do this for my brother's site. He did not want to use perl for what ever reason, so we did it in PHP. Nonetheless, here is what I used. If nothing else it will be a good start.


External scripct called contact.php I directed the flash file to look for the external file.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.         $your_name = $_GET ['name'];
  4.     $your_email = $_GET ['email'];
  5.     $your_phone = $_GET ['phone'];
  6.     $your_fax =  $_GET ['fax']; 
  7.         $your_message =  $_GET ['comments'];
  8.  
  9.         $recipient_email = "enter_the_email_address_here_where_you_want_it_sent"; 
  10.  
  11.         $subject = "from" .$your_email;
  12.         $headers = "From:" .$your_name . "<" . $your_email .">\n";
  13.         $headers .= 'content-type: text/html; charset=iso-8859-1';
  14.  
  15.  
  16.         $content = "<html><head><title>Enter Your Site Title Here</title></head><body><br>";
  17.         $content .= "Name: <b>" . $your_name . "</b><br>";
  18.         $content .= "Phone: <b>" . $your_phone . "</b><br>";
  19.         $content .= "E-mail: <b>" . $your_email . "</b><br><hr><br>";
  20.         $content .= $your_message;
  21.         $content .= "<br></body></html>";
  22.  
  23.         mail($recipient_email,$subject,$content,$headers);
  24. ?>                         
  25.  
  26. <html>
  27.  
  28.      <body bgcolor="ffffff">
  29.  
  30.        <div align="center" style="margin-top:60px;color:#000000;font-size:11px;font-family:tahoma;font-weight:bold">
  31.             Your message was sent. Thank you!
  32.  
  33.            </div>
  34.  
  35.          </body>
  36.  
  37.       </html>
  38. <script> resizeTo (300, 300) </script>
Once it was submitted then a popup window 300 x 300 displayed a simple message. Then the flash redirected to the home page. Hopefully something like this will work for you.

I don't know php, so I can not say that there are not some security issues. I do know that he has not had any problems, and it has been about a year now.

If you want to do this in perl the look into use a module like Mail:Sendmail (which is really basic and user friendly. It is bound to be better than what the Matt's script is offering you.

Good Luck!

Note:: Jeff please don't shoot me for posting PHP code:) Thanks!
Shoot you? Nah, you gave an objective solution. Whether or not I should move this to the PHP forum if he has questions about it? That is another story. ;-)
Oct 14 '07 #7

KevinADC
Expert 2.5K+
P: 4,059
I've got a 30-06 round with eWish written on it. POW!!
Oct 14 '07 #8

P: 9
Hi, thanks again to all for the speedy reply.

I'm going to have to try and digest your info because it's new to me but thanks for taking the time to provide a possible solution.

Cheers.

D.
Oct 14 '07 #9

numberwhun
Expert Mod 2.5K+
P: 3,503
I've got a 30-06 round with eWish written on it. POW!!
Well, considering the OP's last post, I am sticking to my.....er.....guns (yeah, that's it), that if he has questions on our newest PHP experts solution (he he, had to eWish), that I can move this to the PHP forum. :)

Regards,

Jeff
Oct 14 '07 #10

P: 9
Thanks again for the replies guys, thanks as well for not trying to totally lose me in respects from a beginners POV.

I've placed some code below (which I must be honest and admit I have tried in another forum but not achieved any luck with) but since we are talking PHP, I wanted to see if I could use my current actionscript with, instead of the PERL I've been failing with currently.

Basically it's the actionscript attached the the submit button on my form along with some PHP I could 'possibly' use in place of the PERL I've been trying to use so far but failed with.

As always, any thought would be appreciated.

Thanks again.

D.

Expand|Select|Wrap|Line Numbers
  1. //----------------------my actionscript-------------------------------\\
  2. var fullName:TextField;
  3.  
  4. var fullAddress:TextField;
  5.  
  6. var postcode:TextField;
  7.  
  8. var telNumber:TextField;
  9.  
  10. var emailAddress:TextField;
  11.  
  12. stop();
  13.  
  14. var gatherForm:LoadVars = new LoadVars();
  15.  
  16. function sendForm()
  17.  
  18. {
  19.  
  20. gatherForm.visitor_name = fullName.text;
  21. gatherForm.visitor_address = fullAddress.text;
  22. gatherForm.visitor_postcode = postcode.text;
  23. gatherForm.visitor_telNumber = telNumber.text;
  24. gatherForm.email_address = emailAddress.text;
  25. gatherForm.send("http://www.myaddress.com/cgi-bin/formmail/iopost.pl", "POST");
  26.  
  27. };
  28.  
  29. this.submitButton.onRelease = function()
  30.  
  31. {
  32.  
  33. if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
  34.  
  35. {
  36. gotoAndStop("error");
  37. }
  38.  
  39. else
  40.  
  41. {
  42. sendForm();
  43. gotoAndStop("correct");
  44. }
  45. };
  46.  
  47. //-----------------/my actionscriptt-----------------------------\\
  48.  
  49. //----------------- PHP code --------------------------\\
  50.  
  51. <?
  52. $subject = $_POST['userLocation'];
  53. $message = $_POST['userMessage'];
  54. $from = 'From: '.$_POST['userName']." <".$_POST['userEmail'].">";
  55. $to = "me@here.co.uk"; // Change this email address to your own.
  56.  
  57. /* and now mail it */
  58. $mail_success = mail($to, $subject, $message, $from);
  59. if ($mail_success == true) {
  60. echo '&successvar=1&';
  61. } else {
  62. echo '&successvar=0&';
  63. }
  64. ?>
  65. //------------------ /PHP code --------------------------\\
  66.  
Oct 14 '07 #11

KevinADC
Expert 2.5K+
P: 4,059
pee aych pee belongs in the pee aych pee forum ;)
Oct 14 '07 #12

numberwhun
Expert Mod 2.5K+
P: 3,503
This thread has been moved as it has made its way into the realm of PHP and away from Perl.

Regards,

-Moderator
Oct 14 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.