testez
¿Has encontrado un error? ¿Tienes la solución? Deja tu correción ;-)
Antes de comentar: Gran parte de los ejercicios propuestos no tienen librerías debido a que Wordpress las eliminó al verlas como etiquetas HTML.
Si sabes/tienes/conoces las librerías que hacen falta, déjalo en los comentarios. Y lo mas importante: Todos los ejemplos
fueron realizados por estudiante con únicamente conocimiento básico del lenguaje, no de programación.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 | program CGITest;
{$mode delphi}
uses classes, ezcgi;
// In the following class you only need to use either DoPost or DoGet
// depending on what type of CGI request you want to use. If you only
// are going to be making GET requests that you only need to define
// and override DoGet and like wise for POST requests.
type
TCGIData = class(TEZcgi)
procedure DoPost; override;
procedure DoGet; override; procedure ShowStuff;
end;
var
cgiStuff : TCGIData;
// All output from the CGI must first begin with the WriteContent
// call. This places the passed information and the correct CR's
// required. In most cases you will always use it as shown below.
// However if you ever need to return content that isn't standard// text/html this allows you to set what that content type is.
//
// The PutLine call just passes the information indicated out into
// the stream for return to the client browser.
procedure TCGIData.DoGet;
begin
WriteContent('text/html');
PutLine('++++++++++ Using GET +++++++++'); ShowStuff;
end;
procedure TCGIData.DoPost;
begin WriteContent('text/html');
PutLine('++++++++++ Using POST +++++++++');
ShowStuff;
end;
// I wrote this method so that you can see everything that is passed to
// and stored by the TEZcgi class. It currently stores all normal CGI
// as well as everything passed to the CGI by the client. These
// variables can be accessed via the following properties.
//// Values[Index : string];
// The Index data can be something like AUTH_TYPE, SCRIPT_NAME, or any
// standard HTML or CGI environment variable. This can also be the
// field name of the content being passed in a query string such as
// "name" found in //URL/CGI/cgiapp?name=bob//
// Another routine is availble GetValue(Index, defaultValue : string);
// This routine does the same as the property Values except it allows
// you to set a default value to be returned if no variable of type
// name index is found.
// This data is stored in a TStringList so you can retreive it by index
// as well if you know the index location of the information.
//
// The properties for doing this are Names[index : integer] and// Variables[index : integer]. Names returns the name of the variable,
// this would be the data passed in the values or GetValue calls.
// Instead of returning the value "bob" it returns the value "name". The
// variables property returns the whole string so using the name example
// above it would return "name=bob".//
// To determine how many environment variables have been stored you can
// use the VariableCount property.
//
// The following procedure loops through all of the enviroment variables// and prints them back to the client. This is a good CGI example to
// show you exactly what information you have to work with.
procedure TCGIData.ShowStuff;
var loop : integer;
begin
for loop := 0 to VariableCount - 1 do
PutLine(Variables[loop] + '<BR>');end;
// what follows is the actual program begin..end.
// The Create call for the class does all the work of the CGI loading
// the environment variables.// The FName and FEmail data is used by the Error report. If the CGI
// doesn't work correctly for the user this data is included in an
// error report that is returned to the user which tells them who to
// inform and how.
// The Run command starts processing the CGI request and eventually// calls either the DoGet or DoPost depending on the request type.
// I don't try and trap it but the class does raise an exception called
// ECGIException when some error is generated.
begin
try
cgiStuff := TCGIData.Create;
cgiStuff.Name := 'Michael A. Hess'; // replace with your name
cgiStuff.Email := 'mhess@miraclec.com';// replace with your email cgiStuff.Run;
finally
cgiStuff.Free;
end;
end. $Log: testez.pp,v $
Revision 1.2 2005/02/14 17:13:18 peter
* truncate log
} |
Punto importante: Si vas a sugerir un segmento de código en algún lenguaje debes hacerlo así:
- Si es lenguaje C <code lang="c">Código en C</code>
- Si es lenguaje Pascal <code lang="pascal">Aquí dentro el código de Pascal</code>.
De esta manera el código coloreas el código.
Deja un comentario