Go Premium for a chance to win a PS4. Enter to Win

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

Embedding CGI Script into HTML

Hi

Not sure if this is the right place, but here goes.

I want to put a cgi script into my HTML code.  Is it possible to do this?  I know you can put a page in a page, but can you put a script in a page?

Regards

Peter Thomas
0
development
Asked:
development
  • 4
  • 3
  • 2
  • +2
1 Solution
 
TTomCommented:
If you are wanting to do this simply to illustrate the code, I don't see any problem.  If the intent is to execute the code, I see many problems.

In the first place, you would be asking to execute the code at the client side.  That would be a major security issue.

If you want code on the client side to initiate server side events/scripts, you may be able to do this with some sort of remote scripting, but that would still be code executing at the server.

What is it that you intend with your inserted code?

Tom
0
 
developmentAuthor Commented:
Basically, I have a script which does a domain check, and returns the results.
0
 
ozoCommented:
So do you want to put the results in your page?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
developmentAuthor Commented:
for the page, so you can see what i am talking about, go to :

www.angelsolutions.net/cgi-bin/whois.cgi
0
 
developmentAuthor Commented:
I have given up trying to embed it.  Its been a long time (3 years) since I actually had to write the code myself, so bare with me.  I want to open a window, with no navigation, and minimise and maximise blanked out, and i want to set the dimensions myself.  How can I do this.  
0
 
TTomCommented:
Part of what you wish to do is not very difficult.  Using the JavaScript "window.open()" method, you can open a new window with minimal tools and whatever dimensions you wish.

However, you will not be able to remove the minimize and maximize buttons (so far as I know).

The syntax for the method is:

myWin = window.open("filename","windowname",options)

where options is a comma delimited list, enclosed in quotes.  Options include toolbar, location, directories, status, menubar, scrollbars, resizable, width, height, top, and left.

HTH,

Tom
0
 
mgfranzCommented:
Or, why don'e you just write some HTML code into the CGI?  
0
 
damianoskyCommented:
Basically, you cannot include cgi script in HTML because cgi are server side scripts, in Perl, PHP or C/C++. A client cannot interpret this languages, so it's not possible to achieve this.

If you want a domain checking and get the result, you can get this with a perl script which give you an output according to the situation you program it to. Simply open the windows like TTom has suggested you (for the option see a good book on Javascript because Netscape and Explorer have different features - see O'Reilly books on Amazon.com), and in the filename recall the cgi script.

In This script you will read the system variables for IP address and domain name and will act consequently, sending the appropriate html output to the windows in which you have recalled the script. I suggest you perl as scripting language (more diffuse and more simple than c/c++).

Alternative to cgi are ASP pages (they act similarly to CGI, but they use VBScript or Jscript on server side), but they are available only on Microsoft Web Servers (IIS and PWS); on UNIX you need third part libraries (not free) and you must have an administration account to install them.

On client side you can only use VBScript (but with limitation to Internet Explorer) or Javascript (with compatibility problems between different browsers), but obviously if you need good security level they are bad, because simply viewing source code any user can see you script code.

At last, on HTML pages you can optionally send SSI (Server Side Include) commands which can recall cgi scripts (like access counters). But to use SSI, you must have the server enabled to support them and the extension of the pages must be (in general) *.shtml (but it can be configurated differently)

The best solution is a mix of client and server code. Keep in mind that the best solution is to put security code on server side (remeber to disable directory browsing on the web you do) to hide your code to users, and use client scripts language only for less critical tasks (like validation of input data and managing of forms and windows).

Depending on the technology you use (WinNT or UNIX), use ASP or CGI to achieve your needs.

Good work.


0
 
mgfranzCommented:
Thats an answer???  While it is all good info and generaly basic knowledge, where does it solve the problem?
0
 
TTomCommented:
Well, the answer seems to be, "No, you can't do that".  If development is happy with the explanation (and it's a pretty good one), and doesn't want to go any further looking for a solution...

Perhaps we could solve the problem by other means, but I can live with it.

Tom
0
 
developmentAuthor Commented:
You can go on posting if you want.  I basically gave up, and took the explanation, than a solution.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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