Solved

Embedding CGI Script into HTML

Posted on 2000-03-10
11
399 Views
Last Modified: 2013-12-25
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
Comment
Question by:development
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 9

Expert Comment

by:TTom
ID: 2608202
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
 
LVL 1

Author Comment

by:development
ID: 2609920
Basically, I have a script which does a domain check, and returns the results.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2609946
So do you want to put the results in your page?
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Author Comment

by:development
ID: 2610042
for the page, so you can see what i am talking about, go to :

www.angelsolutions.net/cgi-bin/whois.cgi
0
 
LVL 1

Author Comment

by:development
ID: 2610957
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
 
LVL 9

Expert Comment

by:TTom
ID: 2612137
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2613294
Or, why don'e you just write some HTML code into the CGI?  
0
 
LVL 1

Accepted Solution

by:
damianosky earned 50 total points
ID: 2623127
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2628845
Thats an answer???  While it is all good info and generaly basic knowledge, where does it solve the problem?
0
 
LVL 9

Expert Comment

by:TTom
ID: 2628867
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
 
LVL 1

Author Comment

by:development
ID: 2629209
You can go on posting if you want.  I basically gave up, and took the explanation, than a solution.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question