Forum Moderators: coopster & phranque

Message Too Old, No Replies

cgi permissions

using a sendmail.pl script

         

estebones

11:06 am on Jul 5, 2003 (gmt 0)

10+ Year Member



My webhost makes a sendmail.pl scripts available for me to use but it says some thing to the effect of giving the script permission to read/read-write? Is this to eb done when i create my own script? or why do I need to assign it a permission if its already running on the server?
Also Can someone please enlighten me as to How I can use a cgi script that is in the cgi-bin at my server, How do I call for it? what is the correct syntax to be used in a html form? Sorry for the rookie-ness of the question but I am trying to learn this, and so far I cant find anything about this on the web that is just in plain english!

Thanks in advance.

--esteban

wruk999

11:17 am on Jul 5, 2003 (gmt 0)

10+ Year Member



Hi esteban,

To use the script, with a form, you will need to create something such as the following on a html page, in your normal web directory:

<form action="/cgi-bin/sendmail.pl" method="POST">
<input type="text" name="sender_name" size="35" value="">
</form>

The first line opens up the form, and quotes what file/script will process it, in this case it is in [yourdomain.com...] (where yourdomain.com is the domain that your site is running on)
It also specified the method - POST or GET.

The second line, is an example text field, and the third closes off the form.

I your own case, you will need to read any documentation with your script, as you will more than likely need to send it to a central location and also include hidden fields, such as recipient address and redirect page.

Do you have any documentation/instructions with the script?

wruk999

estebones

12:41 pm on Jul 5, 2003 (gmt 0)

10+ Year Member



So since I would be using this to have users send an email I would use the POST method right? and how can I define the address that the message will go to, will this have to be in good ol' html ( mailto="blah")if so I think I got a pretty good idea.
I can understand html and javascript pretty good but I just have never done anything with cgi this would be my first interaction with it so I apologize for my ignorance, but its aprehension to this from of script more than anything...any other suggestions/advise on this?
thanks
--este

wruk999

12:53 pm on Jul 5, 2003 (gmt 0)

10+ Year Member



The variables all depend on the particular script.
The most common is Matt Wrights FormMail. (Or NMS which use same settings)
The reasons that some hosts rename it is because rogues try and spam your formmail scripts.

In the case of standard formmail, these are the variables you would need to use:


<form action="/cgi-bin/sendmail.pl" method="POST">
<input type="text" name="realname" size="35" value="">
<input type="text" name="email" size="35" value="">
<input type="hidden" name="recipient" value="you@yourdomain.com">
<input type="hidden" name="subject" value="form submission from website">
<input type="hidden" name="redirect" value="http://www.yourdomain.com/thanks.html">
<input type="submit" name="submit" value="Submit">
</form>

The above should be pretty self-explanatory.
email - If one of the things you're asking the user to fill in is their email address and you call that input 'email', formmail will use it as the address part of the sender's email address in the email.

realname - If one of the things you're asking the user to fill in is their full name and you call that input 'realname', formmail will use it as the name part of the sender's email address in the email.

Give it a try and see what, if any, errors you get?

wruk999

estebones

4:35 am on Jul 6, 2003 (gmt 0)

10+ Year Member



Thanks! you've pretty much cleared up any other? I may have, I'll put the script to work so hopefully it'll all go well

--esteban

estebones

4:41 am on Jul 19, 2003 (gmt 0)

10+ Year Member



blah! this damn cgi thing has me perplexed: maybe someone can help!
heres the code I use:

<form action="cgi-bin/FromMail.pl" method="POST">
<input type="hidden" name="recipient" value="myname@maydomain.com">
<input="hidden" name="redirect" value="www.WebmasterWorldebsite.com/thankyou.html">
<input type="text" name="field1" value="">
<input type="text" name="filed2" value="">
<input type="submit" name="submit" value="submit">
<input type="reset" name="reset" value="reset">

--still I get some error saying something about an Sbox and that the cgi was poorly written..bla, blah, blah!
also, my webhosting company says I need to change the permission on the perl script but I can find where to change this and while the actual perl script is very descriptive, yet I can't find out how to change this?
may be some one can help PLEASE!
--este

wruk999

7:46 am on Jul 19, 2003 (gmt 0)

10+ Year Member



estebones,

Sorry to hear about the trouble you are having. The form code looks okay, but as you said, if the error is lying with the perl script then what you posted is irrelevant, as it is okay.

As for the permissions, this can often be a fundamental part to a perl script.

what are you using for FTP software?
If using WS_FTP or CuteFTP, then when you are logged into your server, navigate to your cgi-bin directory, and click the sendmail script once. Then right click it, and one of the options will be CHMOD (Unix).
When you click on this, you will have nine checkboxes.
3 for Owner
3 for group
& 3 for other

You will need to read through your sendmail script/readme and fine where it gives a set of permissions it needs. It will most likely be a set of 3 numbers, ie: 766.

This translates to what checkboxes you need to select in the chmod option. The first number in that set of three, is for owner, the middle number for group and the last number for other.

Under each heading (Owner, group, other) there are three checkboxes: Read, Write Execute

Here is what each number means (ie: which checkbox needs to be ticked):


7 = rwx
6 = rw-
5 = r-x
4 = r--
3 = -wx
2 = -w-
1 = --x
0 = ---

The r means the read needs to be checked, the w means write needs to be checked and the x means execute needs to be checked. Once you have found the three numbers it requries as permission, look at the above table and see what permissions you need to set for it. Then follow the earler instructions, press ok, and then test your script.

(from my earlier example, if the permissions needed were 766, you would tick:
owner: Read, Write & Execute
group: Read, Write
other: Read, Write )

wruk999

wruk999

7:49 am on Jul 19, 2003 (gmt 0)

10+ Year Member



Just another quick note:

You posted this:

<form action="cgi-bin/FromMail.pl" method="POST">

The file this is in must be in the root directory for it to work, or if you put a '/' before cgi-bin it will work anywhere on your site:
<form action="/cgi-bin/FromMail.pl" method="POST">

<added>Just noticed aswell you are calling frommail. Have you renamed the script or should it be formmail? </added>
wruk999

estebones

12:21 pm on Jul 19, 2003 (gmt 0)

10+ Year Member



yeah I cant type very well when I get frustrated...
I think you have just got me out of the hole, I did everything except set the permissions, I could not figure it out and the readme was not very helpful with this. I'll try this and hopefully it will work.
Thanks a lot

--este

estebones

8:22 am on Jul 20, 2003 (gmt 0)

10+ Year Member



ok what does this code tell you:

Fax 713-123-1234, e-mail: <a href="mailto:&#109;&#101;&#100;&#112;&#114;&#111;&#109;&#112;&#116;
&#64;&#115;&#98;&#99;&#103;&#108;&#111;&#98;&#97;&#108;&#46;&#110;&#101;&#116;

?subject=company inquiry">Customer&nbsp;Service<br>
<!-- support at company.com
&#115;&#101;&#114;&#118;&#105;&#99;&#101;&#64;&#99;&#118;&#111;&#108;&#97;
&#98;&#115;&#46;&#99;&#111;&#109;
-->

This is some code for some links/navigation bar within the website, is this some sort of inscription, I believe this is a cgi thing but how can I fix the webpage if this is all i have to go to?
Any help would be appreciated.

[edited by: jatar_k at 5:54 pm (utc) on July 20, 2003]
[edit reason] cut long lines for sidescroll [/edit]