Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2004, 07:32 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default CGI Script Feedback form

Hi all,

Have set up a feedback form in my website http://www.cubid.co.uk/contact.htm

though I am having trouble writing or getting a script to send it my server and then back to me.

I understand that the best method is to use CGI scripting (have located the bin etc on my server) though am having trouble setting one up for my forms.

Can anyone help? or offer some scripting for my page? http://www.cubid.co.uk/contact.htm

Cheers

Dan
Reply With Quote
  #2 (permalink)  
Old 06-15-2004, 08:23 AM
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 83
M0rtym0use RepRank 0
Default

dan_bradshaw,
it appears that the file you are referencing does not exist
try this...
http://www.cubid.co.uk/cgi-bin/mylog.cgi
as the path to the cgi file

remember the root of the website is the www not root of the file system

MM
__________________
M0rtyM0use

Simply Rugby
Reply With Quote
  #3 (permalink)  
Old 06-15-2004, 08:55 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

Thanks for this, will have a go at that. Do you mean the link from my submit button?

Thanks for your help
Reply With Quote
  #4 (permalink)  
Old 06-15-2004, 10:42 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

Have tried this though am now getting the internal message error...do you think it maybe my script that is causing the problem?

Are you able to view the script for me?

Thanks

Dan
Reply With Quote
  #5 (permalink)  
Old 06-15-2004, 12:30 PM
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 83
M0rtym0use RepRank 0
Default

dan_bradshaw,

Sorry i no v.little about cgi itself but you may want to check that there are execute permissions on that folder etc as this could be causing this.

MM
__________________
M0rtyM0use

Simply Rugby
Reply With Quote
  #6 (permalink)  
Old 06-16-2004, 09:34 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default Forms, CGI, perl...Arrrghh

Hi all,

I am having real trouble with my forms and script to process them.

All that keeps coming up is
500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, info@cubid.co.uk and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Is anyone able to help me?

I can them the script and other details if necessary

Cheers

Dan
Reply With Quote
  #7 (permalink)  
Old 06-16-2004, 10:38 AM
WebProWorld Pro
 

Join Date: Jul 2003
Location: New Jersey, U.S.
Posts: 293
jdiben RepRank 0
Default

Try removing the second "form" from the following line
<form action="http://www.cubid.co.uk/cgi-bin/formmail.pl" form method=post name=form1>

Joe
Reply With Quote
  #8 (permalink)  
Old 06-16-2004, 10:47 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

I have replaced the form with a much simpler form and made sure that I have not got any extra formsin now. The dam thing still doesn't work...grrr

I don't think it could be related, but the e-mail address I have got the script forwarding to is one which has a auto responder, could this be affecting it?
Reply With Quote
  #9 (permalink)  
Old 06-16-2004, 01:26 PM
xmx's Avatar
xmx xmx is offline
WebProWorld Veteran
 

Join Date: Mar 2004
Location: Switzerland
Posts: 345
xmx RepRank 0
Default

I cannot give a precise solution, but it could be a problem related to permissions of the perl files.

Otherwise it could be that the path to perl is not correct.
Reply With Quote
  #10 (permalink)  
Old 06-16-2004, 04:58 PM
WebProWorld New Member
 

Join Date: Dec 2003
Location: Canada
Posts: 2
zelo RepRank 0
Default

Your sever should have a good help desk. Someone there should be able to point you in the right direction.
Quote:
Originally Posted by xmx
I cannot give a precise solution, but it could be a problem related to permissions of the perl files.

Otherwise it could be that the path to perl is not correct.
Reply With Quote
  #11 (permalink)  
Old 06-16-2004, 05:48 PM
G[dot]com's Avatar
WebProWorld Veteran
 

Join Date: Mar 2004
Location: Buenos Aires - Argentina
Posts: 304
G[dot]com RepRank 0
Default

Dan, Hi!

As Zelo mention this is something that the people of the hosting in which you have your site MUST help you with.

Moreover, before you do anything on your own and waste time and stress yourself out, it is convenient that you contact the help desk and ask as a 2 year-old boy:

"Hi I have to add some forms to in my site. Which aplications do you use to process the scripts? And do you have templates to send to me so I customize them with my needs?"

They have to help you, and they will give you excactly the information you need for your site. No one will know better than them.

Hope I am helping you with this, kiss,

Gi
Reply With Quote
  #12 (permalink)  
Old 06-16-2004, 05:50 PM
WebProWorld Pro
 

Join Date: Oct 2003
Location: Phoenix, AZ
Posts: 183
chowell RepRank 1
Default Test permission, upload type

The error you're receiving is generally caused by one of the following...

1) The file permissions of your formmail.pl file are not correct. They should be set to "755" in order to properly run the script.

2) The file was not uploaded using Auto-ASCII or ASCII. If you upload the file in "binary" mode, it will not work properly.

3) The first line in the formmail.pl file is not the correct path to perl. (ie: #!/usr/bin/perl). The default path is not always right. You should check with your host for the correct path.

I'm pretty confident that this information will help you get the form working properly.
Reply With Quote
  #13 (permalink)  
Old 06-16-2004, 07:41 PM
WebProWorld New Member
 

Join Date: Mar 2004
Location: Berkeley
Posts: 4
epern RepRank 0
Default My PERL form fix

Hi,

I had the same problem . I re-checked the "755" rule, ascii only upload, correct file location (BTW, After I started using CuteFTP , the EXACT location of server files became more clear. Dreamweaver befuddled things a bit)
I was still getting errors...

Anyhoo, I edited the actual mailform.pl file and deleted the "@referer" section. About 15 lines of code.

This did the trick for me.

Now... I would love it if someone could explain the finer points of ordering the data!! I have 15 "inputs" in a logical order on my form(name, address, coutry, phone, etc...), when the data is parsed and emailed, it seems to be in a random order in the resulting email.

Thanks and good luck!
Reply With Quote
  #14 (permalink)  
Old 06-16-2004, 07:46 PM
WebProWorld New Member
 

Join Date: Mar 2004
Posts: 5
kenmcc RepRank 0
Default For scripts r a pain!

I agree with chowell...

Personally I ditched this method a few years ago, mainly because of the security holes associated with cgi mail scripts like formmail, also because you can't do stuff like send html mail.

Have you tried using the php mail function? Its far more flexible... here's an example script

<?php
// Ken McCormack / P21

$recipient = "recipient@domain.com.au";
// do not pass email recipient from form!!

$recipient_name = "Fred Smith";

if ($submit) {
// if form has been submitted, send mail

$name = $_POST['firstName'] ." " . $_POST['lastName'];

$text = $_POST['message'] . date("jS F Y G:i:s");
$redirect = $_POST['redirect'];

$email = $_POST['Email']; // sender's email

$head = "MIME-Version: 1.0\r\n";
$head .= "Content-type: text/plain\r\n";
// or for html formatting
// $head .= "Content-type: text/html; charset=iso-8859-1\r\n"; // for html mail

$head .= "From: " . $name . " <" . $email . ">\r\n";
$head .= "To: " . $recipient_name . " <" . $recipient . ">\r\n";
$head .= "Reply-To: ". $name . " <". $email .">\r\n";
$head .= "X-Priority: 2\r\n";
$head .= "X-MSMail-Priority: Normal\r\n";
$head .= "X-Mailer: PHP";

$subject = "Site Name Website Enquiry - " . $fullname;

mail($recipient, $subject, $text, $head);

// redirect to next page
header('Location: ' . $redirect); /* Redirect browser */
exit;

} // end if

?>

That's all there is to it! If you're not conversant with Perl, PHP mail is a much more user friendly means to control mail from web forms.
Reply With Quote
  #15 (permalink)  
Old 06-16-2004, 07:58 PM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

If it's just HTML formatted emails you're after, PHP is certainly not the only alternative.. most mailer scripts have some means of formatting the email that is sent.

I've used a variety of Perl, CGI and ASP scripts that have ALL offered the possibility of HTML emails... IMO the choice of scripting language is immaterial... as has been suggested earlier Dan, check with your hosting support first.. they may have ready-made solutions for you. If that doesn't help, feel free to send me the script and I'll help in any way I can.

Paul
Reply With Quote
  #16 (permalink)  
Old 06-16-2004, 10:59 PM
WebProWorld New Member
 

Join Date: Mar 2004
Posts: 5
kenmcc RepRank 0
Default

I give up, make a suggestion and you get a response like that. What a waste of time. Time to unsubscribe.
Reply With Quote
  #17 (permalink)  
Old 06-16-2004, 11:21 PM
G[dot]com's Avatar
WebProWorld Veteran
 

Join Date: Mar 2004
Location: Buenos Aires - Argentina
Posts: 304
G[dot]com RepRank 0
Default

kenmcc,

You are *very* welcome TO leaving.

Actually I´d like to see no more people here being agressive or critizizing other´s posts and help.

So, please, Kenmcc, unsubscribe the sooner.

And if you know some one else that thinks like you about this forum, it would be great if they join you.

:o)

Gisela
Reply With Quote
  #18 (permalink)  
Old 06-17-2004, 01:58 AM
WebProWorld Veteran
 

Join Date: Apr 2004
Posts: 453
HardCoded RepRank 0
Default

Geez, quit helping people Paul.

ken, the real point is that the poor guy can't run CGI scripts. That's not useful. He should check with his host and get the paths straightened out.

And while I agree that formmail.pl is notorious for being spam bait, it is certainly possible to write a secure perl script. And an insecure PHP script.
Reply With Quote
  #19 (permalink)  
Old 06-17-2004, 03:53 AM
pgm pgm is offline
WebProWorld New Member
 

Join Date: Jun 2004
Posts: 1
pgm RepRank 0
Default cgi problem

You will also get this error if you do not put an escape character in the email address in the scritp.
you\@you.com
Reply With Quote
  #20 (permalink)  
Old 06-17-2004, 05:48 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

Hi,

Thanks for all your comments and suggestions, I will check them all out this morning... I have been on to the hosts who seem to be sorting things out, or at least looking into it.

Not sure what kenmcc was on about...

PHP does sound more user friendly, though I will also go back and check the code.

Have many other people used the formmail from scriptarchives.com? It seems pretty straight forward, only having to change a couple lines of code...however things are never as easy as they seem.

Thanks

Hope you are all routing for England lads today.

Dan

Cubid Imagery...Innovative Solutions and Creative Web Designs...when it works

www.cubid.co.uk
info@cubid.co.uk
Reply With Quote
  #21 (permalink)  
Old 06-17-2004, 06:18 AM
G[dot]com's Avatar
WebProWorld Veteran
 

Join Date: Mar 2004
Location: Buenos Aires - Argentina
Posts: 304
G[dot]com RepRank 0
Default

Hope your hosts help you to get a definite solution, Dan.

I bet they will be able to. They are used to deal with these script´s *inconveniences*

And thank you for your thanks :o)

Kiss

Gi

BTW eventhough I am used to ASP because of my hosting services which run under Windows NT platforms (ASP friendly), I found that PHP is really simple.

Seems that the creators of PHP have clearer minds and more common sense than other language programmers :oP
Reply With Quote
  #22 (permalink)  
Old 06-17-2004, 06:38 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

Quote:
Originally Posted by kenmcc
I give up, make a suggestion and you get a response like that. What a waste of time. Time to unsubscribe.
What can I say? My reply was contributing to the general discussion, there was no intention to demean your suggestion Ken. As Gisela says, PHP can offer very neat and user-friendly code, I have no doubt of that fact.
Dan's problem is mostly concerned with his CGI/Perl script, and I was offering to help if he got no joy from his hosting support.
Quote:
Originally Posted by dan_bradshaw
Hope you are all routing for England lads today.
Most certainly will be! 17:00 GMT kickoff.. come on you England!! :o)

Good luck with your script Dan, post back if you have any further problems.
Reply With Quote
  #23 (permalink)  
Old 06-17-2004, 08:16 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

Cheers again and thanks g[dot]com for your thanks and the little kiss. ;-D
Reply With Quote
  #24 (permalink)  
Old 06-17-2004, 08:27 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: London
Posts: 146
dan_bradshaw RepRank 0
Default

<?php
// Is this the heading?

$recipient = "info@cubid.co.uk";
// do not pass email recipient from form!!

$recipient_name = "Cubid Imagery";

if ($submit) {
// if form has been submitted, send mail

$name = $_POST['firstName'] ." " . $_POST['lastName'];

$text = $_POST['message'] . date("jS F Y G:i:s");
$redirect = $_POST['redirect'];

$email = $_POST['Email']; // sender's email

$head = "MIME-Version: 1.0\r\n";
$head .= "Content-type: text/plain\r\n";
// or for html formatting
// $head .= "Content-type: text/html; charset=iso-8859-1\r\n"; // for html mail

$head .= "From: " . $name . " <" . $email . ">\r\n";
$head .= "To: " . $recipient_name . " <" . $recipient . ">\r\n";
$head .= "Reply-To: ". $name . " <". $email .">\r\n";
$head .= "X-Priority: 2\r\n";
$head .= "X-MSMail-Priority: Normal\r\n";
$head .= "X-Mailer: PHP";

$subject = "Site Name Website Enquiry - " . $fullname;

mail($recipi