" Common Gateway Interface (CGI ) translation means Common Gateway Interface
This is a great tool which is used very often, because it allows a user to request data or information of a program that is running on a server.
Briefly is a transfer from user to server.
For example, when a question and get an answer, has been something of its operation .
We mention this is a dynamic content, since there can vary, depending on the request made.
This program can be written in any programming language , but I recommend you use python or java, perl , because they are easy to use and there are many online tutorials that will describe its operation .
As it works?
- The first thing you do is that the server receives or you get a question (request)
- After the server prepares the environment for immediate execution and executes mind.
- This is when the application makes its function Already a
- see that finished, the server sends the information produced.
Some common examples of these, for example, when we enter an account online, you first have to fill out some forms and then later get an answer, also when a survey, or some questions to be answered, to get the results, etc.
Here I leave an example I did:
The example is about access to the system asking for your username and password.
Here I leave the screen shots:
Here asks data
completed the form, for this creates a. Txt called abraham and in which this holds the key, the key put it visible.
Ya, here gives you the answer. Operation:
Here is the html code which you have to save / var / www / file.html name. The code is simple, if anything the only thing to note is in the 6 th line I mention where is located the program that will answer.
And in the last lines, states that see a button to send the request. The other
pate of code, which will be its response is stored in / usr / lib / cgi - bin / file name. Py because what we are doing in python
The first line does is it prints the response as the answer must be in html header made it.
Here is requesting access and takes the reading of the request being sent and stored in the variable "name" and print the name of "user." Here
take what is sent in the password variable that this will be the key the user entered for this, read a file called "user." Txt , read its contents, this is thanks to the command that reads split up, "", the content will be the key, if this is the key, prints the counter is correct.
Otherwise show error, of So easy is to create a cgi , only question you put to practice and play.
0 comments:
Post a Comment