Solved

Embedding CGI Script into HTML

Posted on 2000-03-10
11
387 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now