Write the CGI program with Delphi (6)

zhaozj2021-02-17  54

Write the CGI program with Delphi (6)

In several chapters of the front, I have finished the general discussion of the CGI program. Here, I give a simple set of model as a summary of the previous content. To use this program, you need Omnihttpd's latest test version: Omnihttpd 2.0b1 (beta 1) for Windows 95 / NT. If you don't have it, you can download (OH20B1.zip). Installing Omnihttpd in the same way in the first lecture, this is no longer talking. I only talk about some of this version of this version of this version: Open Omnihttpd Property Settings Dialog box, use the Web Server Global Setting button to transfer to the External page, and delete the .cgi settings. When not deleted, the CGI program with the CGI extension is processed as Perl program; in our course, the extension of the CGI program in the Perl language is .pl, and compiled CGI program extension is .cgi, So, to set this modification. In this version of Omnihttpd, the support of the SSI (Server Side Include) command is greatly added to the previous version, supporting include, exec and other commands. In the show, I used these commands. After you download (ex 8.zip), the bread contains three documents: index.shtml, makelog.cpp and makelog.exe. Index.shtml is a script containing the SSI command. Copy to the C: / httpd / htdocs directory; makelog.exe is the CGI program, copy it to the C: / httpd / cgi-bin directory; makelog.cpp is MAKELOG. EXE source file, if you want to modify compilation, you must use 32-bit compilers, such as VC, etc., otherwise it will not be available. In addition, you need to make a modification in Omnihttpd: select Default Virtual Setting, change Default Index to Index.SHTML on the Server page. In this way, when you type http: // localhost in the browser, OMNIHTTPD automatically adjusts index.shtml. Do a web document, save the file name in the C: / HTTPD / HTDOCS directory with index.html.

When you use a browser to visit LocalHost, Index.shtml first calls Makelog.exe, the storage information of the storage household, then call index.html, display it in the browser. User's access information is stored in the UserLog file in the C: / HTTPD / CGI-BIN directory. This example uses the basic environmental valence and SSI technique in the CGI specification. Please study it. 4. Database in CGI should be, the application of the data library is the most physical CGI program. On the internet network, the data library is not often much, and the needs of the Web applications of these data libraries are also more and more (no theory is to come from the company or the needs of the self-employment). It can be said that the Web is a huge data library, and why these plenty of data is set up, and the WEB has been put on the Web, which is a topic of the CGI and the Database System. If you want to classify the CGI and the data library, there is a category method that is different from the different angle. For example, according to the size of the database, it can be divided into text databases, local databases (Microsoft Access, etc.) and database servers (MS SQL Server, Informix, etc.); can be divided into front-end database CGI programs (users who use web browsers) according to CGI processing contents Interaction CGI program) and backend database CGI programs (CGI programs interact with database), etc. Selecting the Database of the Database This is often done in the amount of tasks, costs you have to complete; use the front end and the rear end to the front end and the rear end during the compilation of the CGI. Typically, if your data set is within a few megabytes, and there is no complex relationship between your data records, you can choose to create a database with a text file, which makes cost limit in minimal, and text file has a database. The management system (DBMS, Database Management System) does not have the advantage: If your data has an error, you can transfer your text file into any text editor for recovery, and if your database system has an error, Unless you're a database expert, it is difficult to repair. If your data is uncommon, or the data store system is used in your data records, the data library system is preferred. Use textual documents to realize a few tandes of data libraries to make any high-grade RISC server unloaded.

If you use the CGI program to handle the complex relationship between the data, you will inevitably increase the complexity of the CGI program, accounting for too much server resources; on the other hand, the function of using the database system can simplify the difficulty of CGI program design, improve development efficiency . When choosing a database system, you need to choose from the following aspects: 1. Operating system platform: You should choose the database system you are most familiar with, but also choose your most familiar operating system platform, only then can you be less error. Second, the price: You should choose the cheapest in various database systems that can complete your work. Here, I can tell you a free database system, called Minisql, it must be run on UNIX or Linux platform, I I don't know where there is a free database system for the Windows platform. If you know, please tell me, I will tell everyone in the future course. Our program is to tell the CGI program in Delphi, and Delphi provides the Interbase Server Database System, which I will introduce the main CGI program in this way. At the same time, a large amount of codec is reduced by the database system, I use the front-end CGI and the rear end CGI in the equation, and in a CGI program, the use of the user inputs the processing and the data library operation. But in his system platform, it is also useful to use this form, please ask the readers to discuss the front. Here, I want to include several different CGIs and their use in our Omnihtpd: Standard CGI: Standard CGI, must be placed in / cgi-bin / setup, you can modify it at Omnihttpd . WIN CGI: CGI in Windows system should be placed under the / cgi-win / setup. This CGI should use Ini files to obtain requests for household browsing, rather than use environmental variables or standard input. We do not use this CGI. ISAPI: The CGI specification of the application dynamic link in the Microsoft company. NSAPI: The CGI specification of the Netscape company proposed to use dynamic links.

转载请注明原文地址:https://www.9cbs.com/read-30776.html

New Post(0)