 |
 |
Can you modify a .cgi in text edit?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2004
Status:
Offline
|
|
Hi Everyone. Yes, I am hoping someone can help me out again.
This is probably win the prize for the most stupid question contest, but here it goes.
I wanted to know if it is possible to modify a .cgi script in text edit without causing problems?
The reason that I ask is this:
I have created a form in DWMX with about 6 fields. The form does a post to a cgi program. The .cgi script that I am using I took off a cdrom from a book and did a few modifications with textedit. Nothing harmful, just changed the email address and a few other things.
So here is the problem. When I test it on a mac, either with Netscape, Chimera, IE, or Safari, everything works fine. I get the results page and the email with all of the information from the fields. Everything is fine. When I do it on a pc, the results page shows fine, but the email only has the results from 1 field on the form. I have tried this on the pc with both IE and netscape.
If this is not the problem and anyone has anyother suggestions, I would love the help.
As always, thanks for the help!
Don
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
".cgi" doesn't actually say much. It could be one of a few different things: a shell script, a compiled program that conforms to the cgi api, an AppleScript, or a few other things.
If it is a shell script, then the answer is yes, you can just edit it in a text editor.
If it is a compiled program, then no... not without knowing assembly (simple answer: no).
If it is an AppleScript, then it might be a compiled or a source applescript... you might be able to open it in Script Editor.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2004
Status:
Offline
|
|
Thanks for the reply Larkost. When I look in the cgi(mailform.cgi), it states that it is a generic cgi email generator and it uses sendmail. In the instructions, the creator states that you can modify the destination email address as well as the correct directory for the sendmail program.
I don't know if that clears it up. Sorry I didn't put that in the original post.
Don
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by dondefalco:
Thanks for the reply Larkost. When I look in the cgi(mailform.cgi), it states that it is a generic cgi email generator and it uses sendmail. In the instructions, the creator states that you can modify the destination email address as well as the correct directory for the sendmail program.
Well, from your response we can learn that it's not a compiled program. However it's not clear what it actually is. At the top of the file you'll see a "pound-bang" or a "shebang" like this:
#!/usr/bin/perl
or
#!/bin/sh
or
#!/usr/bin/env python
or something like that. That line tells you what kind of CGI it is. In any case, the file is something you should be able to edit with TextEdit and have no ill effects. If you're having a problem, consider checking the web server's error log (/var/log/httpd/error_log by default on OSX).
Is the server the same in the Mac and PC cases? If not, try it that way. There's no obvious reason why a PC would behave differently as a web client than a Mac, and it's very doubtful if the different behavior it would not be caused by the CGI.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2004
Status:
Offline
|
|
Thanks Arkham. Here is the information you were questioning:
#!/usr/local/bin/perl
# mailform.cgi
The server is the same in both cases. I am using globat.com as the provider.
Would you then say that the problem maybe with my form?
Thanks again!
Don
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by dondefalco:
Thanks Arkham. Here is the information you were questioning:
#!/usr/local/bin/perl
# mailform.cgi
The server is the same in both cases. I am using globat.com as the provider.
Would you then say that the problem maybe with my form?
The script is a Perl script. Perl is a very popular CGI scripting language.
If it processes the form correctly from one browser and not correctly from another (regardless of platform), then it must be receiving different data from the different browsers. It may be that the form is being parsed differently on different systems. Make sure you have balanced all your quotes and tags (especially within the form). Some browsers might forgive an HTML error when another will not.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2004
Status:
Offline
|
|
Thanks for the help Arkham_c!
I finally fixed the problem. With your advice, I spent some more time looking at my form. just about 4 hours of looking! Anyway, the problem was that I set the enctype to text when I was trying to do something else a few days ago. Well to make a long story short, I never changed it back and it carried with every revision. Since in the begining I was only checking with a Mac, I never saw the problem. Everything is working fine now.
Thanks again for the help.
Don
(enctype="text/plain"
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Mar 2004
Status:
Offline
|
|
I"ve had plenty of problems editing things in TextEdit. Why? Apple did not make it simple for TextEdit to create plain-text files in TextEdit, only RTF and doc. Opening a text file may preserve its text status, but creating a new one can be a bit trying.
I would suggest something like SubEthaEdit... even if you have no clue what you are doing with what you are editing and don't need any of the features, even the way it colors quoted text can be handy when making sure you didn't miss a quote. I think dreamweaver's source editing mode has syntax highlighting, too, so you could use that.
Saw above you seemed to find a solution, so I might be repeating other stuff... just thought I'd chip in 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
Originally posted by Turnpike:
I"ve had plenty of problems editing things in TextEdit. Why? Apple did not make it simple for TextEdit to create plain-text files in TextEdit, only RTF and doc. Opening a text file may preserve its text status, but creating a new one can be a bit trying.
In the preferences you can set what you want to be default when creating a new window, RTF or TXT. If you want to keep RTF but use TXT occasionally then choose 'Convert to plain text' from the menu or command-shift-t. If you want to open a file but not have it be interpreted as, for instance an RTF or an html page then I believe you can choose that when using the open dialog and you should also be able to set it via the prefs.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|