formvars * cgi_process_form ()
Process HTML form or URL data.
void cgi_fatal (const char *msg)
Kills the application with a message.
int cgi_include (const char *filename)
Include static files.
void cgi_init_headers ()
Initialize HTML headers.
char * cgi_param_multiple (const char *name)
Return all values with the same name sent by a form.
void cgi_redirect (char *url)
Recirects to the specified url.
int cgi_init ()
Main cgi function.
void cgi_end ()
Performs cgi clean ups.
char * cgi_unescape_special_chars (char *str)
Transforms' URL special chars.
char * cgi_escape_special_chars (char *str)
Transforms' special characters into hexadecimal form ( %E1 ).
char * cgi_param (const char *var_name)
Gets the of HTML or URL variable indicated by 'name'.
void cgi_send_header (const char *header)
Sends a specific header.
Performs cgi clean ups.Provides some methods to clean memory or any other job that need to be done before the end of the application.
See also:
Transforms' special characters into hexadecimal form ( %E1 ).Parameters:
Returns:
See also:
Kills the application with a message.Writes msg and terminate
Parameters:
Include static files.Function used to include static data ( normaly html files ). File contents will never be processed. Note that I don't scan for any special character. The reason I did it is, if the you are using this library, you have a shell where you can compile the cgi program. And can do much more ;-)
Parameters:
Returns:
See also:
cgi_include('top_bar.htm');
Main cgi function.Configures all (most?) we need to get cgi library working correctly. It MUST be called before any other cgi function.
See also:
Initialize HTML headers.You need to call this function before that any content is send to the brosert, otherwise you'll get an error (Error 500).
See also:
Gets the of HTML or URL variable indicated by 'name'.Parameters:
See also:
// ...
char *contents;
cgi_init();
cgi_process_form();
cgi_init_headers();
contents = cgi_param('foo');
puts(contents);
// ...
Return all values with the same name sent by a form.Parameters:
Returns:
See also:
Example: For example, if in your HTML you have something like
'What do you like??'
Computers : <input type='checkbox' name='like' value='computers'><br> Internet : <input type='checkbox' name='like' value='net'><br> games : <input type='checkbox' name='like' 'value='games''><br>
then, to retrieve all values, you can make a code like
// ... char *data; \ ... while ((data = cgi_param_multiple('like')) != NULL) puts(data); \ ...
Process HTML form or URL data.Used to retrieve GET or POST data. It handles automaticaly the correct REQUEST_METHOD, so you don't need to afraid about it.
Returns:
See also:
Recirects to the specified url.Remember that you cannot send any header before this function, or it will not work. Note:
LibCGI does not implement RFC 2396 to make the lib simple and quick. You should be sure to pass a correct URI to this function.
Parameters:
cgi_redirect('http://wwww.linux.org');
Sends a specific header.Sends a specific HTTP header. You won't need to add '\n\n' chars.
Parameters:
Returns:
See also:
Transforms' URL special chars.Search for special chars ( like %E1 ) in str, converting them to the ascii character correspondent.
Parameters:
Returns:
See also: