PDA

View Full Version : Problem with Emailing Form


jrdelaney
08-10-2006, 09:47 PM
I get this problem in my error log on the server:

[2006-08-10 14:44:32]: error: file has no execute permission: (/home/jrdel123/public_html/cgi-bin/form2email.pl)

The website is: www.youngproswebdesign.com/submitresume.htm

Any help? I'm totally new at PERL/CGI scripts...

Thanks!

FishMonger
08-10-2006, 10:39 PM
It means that your script is not executable. You need to set the permissions.

chmod 755 form2email.pl

jrdelaney
08-11-2006, 03:35 PM
How do you chmod?

jrdelaney
08-11-2006, 03:42 PM
Okay, figured out how to chmod.

Now, for some reason, it's not transferring over any information I type in, but it does include anything I checkmark.

Also, how do I make it upload a file and send it to me?

Thanks everyone!

FishMonger
08-11-2006, 04:58 PM
I'm sorry but I lost my crystal ball.

You need to post your script and possibly the html page that calls the script. Also, give us a few more details on what you expect it to do.

jrdelaney
08-11-2006, 05:02 PM
Okay, I've figured out the whole emailing the form and the fields and everything, but when I try to attach my file, it comes up saying:

"Sorry, we need you to check the following
Can't save file /www/files/fieldname_9925.doc"

Here is the url: http://www.youngproswebdesign.com/submitresume.htm

If you want, I can paste the code, or else it might just be easier to do a View Page Source to save space here.

Thanks!

FishMonger
08-11-2006, 05:15 PM
Without seeing your form2email.pl script, there's nothing we can do to help. You can attach it as a .txt file to your post.

jrdelaney
08-11-2006, 05:21 PM
No problem.

Here it is.

Thanks!

FishMonger
08-11-2006, 05:40 PM
It sounds like your web server account may not have write access to the /www/files directory.

Let's see if we can get a little more info into the error message.

change line# 360 from this:
open(FILE,">$_[1]/$filename") || error("Can't save file $_[1]/$filename");

to this:
open(FILE,">$_[1]/$filename") || error("Can't save file $_[1]/$filename $!");

Then run the script and post the error message.

jrdelaney
08-11-2006, 05:47 PM
Okay, now, just add to the end of that error: "No such file or directory" after trying that change.

jrdelaney
08-11-2006, 05:48 PM
And as for the www/files directory, I actually had to make it.

Is there a way to change the properties of that folder to allow write access?

FishMonger
08-11-2006, 06:02 PM
Use the chmod command just like you did on the form2email.pl script, but use 777 instead of 755

jrdelaney
08-11-2006, 06:14 PM
For some reason, it's still saying it can't save it.

Any ideas?

FishMonger
08-11-2006, 06:39 PM
Where is /www/files in relation to your script?

Is it this?
/www/cgi-bin/form2email.pl
/www/files

jrdelaney
08-11-2006, 06:48 PM
Yes, that is it.

jrdelaney
08-11-2006, 08:19 PM
I guess my webserver host doesn't have MIME:ENTITY, so it's kind of pointless, right?

Anyone have any other suggestions, or am I just SOL?

Thanks!

4um
09-02-2006, 02:13 AM
jrdelaney, the "/www/files" might not be the correct path.

Run this script:

#!/user/bin/perl
print "Content-type: text/html\n\n"
print "$ENV{DOCUMENT_ROOT}<br>$ENV{REQUEST_URI}<br>$ENV{SCRIPT_FILENAME}";

That should give you sufficient information to extropolate what the actual path should be.

NiteOwl
09-02-2006, 08:59 AM
I looked at your pages.
I may be wrong but there needs to be a few more changes.


In your form page.
you need a field inside your form tags that tells the script which email to use.

<input type="hidden" name="SendToAddress" value="email1">



change your upload input line back to:
<input type="file" name="fieldname">




In your .cgi script:

put your email address where it says to on this line

$SendTo{'email1'} = 'email@your-website-url.co.uk';


Change this line.

my @file_upload_fields = ("fieldname","fieldname");
to this
my @file_upload_fields = ("fieldname");



Hope this helps.

FishMonger
09-02-2006, 09:46 AM
In your form page.
you need a field inside your form tags that tells the script which email to use.
<input type="hidden" name="SendToAddress" value="email1">

Only do that if you want to open the script to be a portal for spammers.

NiteOwl
09-02-2006, 05:17 PM
It seems that the script was designed to prevent Spamming by hidding the email adddress in the value SendToAddress.
Also, and it allows multiple send to emails, by defineing "email1","email2","email3" in the script....

Email address is now hidden..

Just like the nms project,
Not putting the actual email address in the form is more secure.
It keeps them site bots from collecting your EMail address.

The script checks the referrer to prevent further abuse.

I modified my formmail script to do the same thing a long time ago.

Am i missing something?

FishMonger
09-02-2006, 05:30 PM
I misinterpreted what you were suggesting. I thought you were suggesting to put the actual sendto email address in the hidden field.

I agree, keeping it in the script as opposed to the form is the best method.

4um
09-02-2006, 06:03 PM
For some installations, it may make sense to filter by referrer. It can, however, block legitimate form users and fail to block the unsavory.

Some browsers don't provide referrer information either because of user preference settings or because personal firewall software prohibits it. Furthermore, referrer information can be spoofed.

Browser provided referrer information is really not very reliable.