[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

How do I edit CGI Scripts?

I've found a CGI script that seems to be dynamically building a web page based on a link that is selected. There is a banner (gif image) at the top that is the same for every generated page, but the bottom half of the page is different based on the link that was selected. I'd like to edit the script somehow to change the gif file used, its size, and some other features about how the page is being created. Is there a way to edit the script? I opened it in a simple text editor and it was full of ASCII characters. Are CGI scripts a compiled file that is usually written in Perl or another language? Is there a way to successfully edit this file? I'm fairly new to CGI so I'm not exactly sure how to approach this. Thanks.
0
JagerM
Asked:
JagerM
  • 2
1 Solution
 
yjh123Commented:
CGI could be written in PERL (ASCII) or compiled executables if you programmed with languages such as C.  Anyhow, If you can see the text, and it starts with first line something like #!/usr/local/bin/perl, it is definitely a PERL script.  If you need to edit the file, simply look for the line that says about gif.  It may be xxx.GIF or xxx.gif.  It is case-sensitive.
With PERL, you do not compile.  What you see in the file is the way it will execute.

Another quick and dirty solution to do the job you need, I would just upload a file you want to show and change the new file name to the original name of the GIF file that was shown.

Your CGI will load your new image file anyway by the file name.

0
 
JagerMAuthor Commented:
It must be a compiled file because it's not intelligible when loaded into an ASCII editor. I've actually done what you said, i.e. switching the name of the gif file. It gets loaded, but the html that the cgi file is generating specifies the dimensions of the gif on the screen (width, height) and smushes it drastically. I guess there is no way to alter the compiled file? Is there a way to create another cgi file myself that has the same functionality? I can see the html source that is generated from the script if I go to View|Source in Internet Explorer. Could I somehow copy this into a new Perl script and replace the old one? Are there any pitfalls to this?
0
 
yjh123Commented:
No pitballs at all.

If you see the gabled text, then it is binary executable which means, you cannot edit it.

What does the CGI script actually do?
Creating a CGI file isn't that hard.
Copy a simple one from the Internet and start modifying it.

The source you see in the HTML is the result generated from the CGI so it actually isn't really the content of the CGI script....
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now