cookies man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

sf_cgi(3)		 BSD Library Functions Manual		     sf_cgi(3)

NAME
     params, param, param2, set_cookie, cookie, cookies, html_quote,
     getlanguageprefs — functions to support CGI programming

     url_decode, url_encode — recoding functions

SYNOPSIS
     #include <strfunc.h>

     char *
     param(char *fieldname);

     svect *
     param2(char *fieldname, int flags);

     int
     set_cookie(char *name, char *value, char *optDomain, char *optPath,
	 time_t optMaxAge, char *optComment, int optSecure);

     char *
     cookie(char *name);

     svect *
     cookies(void);

     char *
     html_quote(char *);

     svect *
     getlanguageprefs(void);

     URL-encoding and decoding

     char *
     url_decode(char *str);

     char *
     url_encode(char *str);

DESCRIPTION
     These routines give the user a method of dealing with CGI forms and other
     related data.

     char * param(char *paramName) function used to obtain the form parameters
     by specifying their names.

     svect * param2(char *paramName, int flags) may be required if multiple
     values are expected. It stores the current result in the internal buffer
     and other invocations will destroy its contents.  Flags used to specify
     the type of returned values. If flags = 0, param2() will return the
     decoded values of the parameter specified by paramName.  If flags = 1,
     param2() will return the unmodified (non-decoded) values.	If flags = 2,
     param2() will return the appropriate content types (to use with multipart
     forms and binary values).

     svect * params(void) used to get all the parameter names (keys). Not
     always applicable, sure.

     char * cookie(char *cookieName) and svect * cookies(void) functions are
     used to obtain the cookie by its name or all cookie names, respectively.

     int set_cookie(char *name, char *value, char *optDomain, char *optPath,
     time_t optMaxAge, char *optComment, int optSecure) is used to set a
     cookie. Arguments prefixed by 'opt' are optional.

     char * html_quote(char *) used to escape some symbols, such as quotation
     mark, ampersand, left and right angle quotes, and others. This function
     can be used to safe include any text to the html document.

     svect * getlanguageprefs() returns a pointer to an internal svect struc‐
     ture containing the array of user-preferred languages (from
     HTTP_ACCEPT_LANGUAGE ). If this information is not available, it returns
     NULL.

     char * url_decode(char *) and url_encode(char *) are used to deal with
     url-encoded strings.

EXAMPLE
     void cgiparse() {
	     char *login, pwd, oldpwd;

	     login = param("login");
	     pwd = param("password");
	     oldpwd = param("oldpassword");

	     if(!login || !pwd || !oldpwd) {
		     printf("One or more parameters are missing.\n");
		     return;
	     };

	     /* ... some job ... */

	     /* This will produce the following output:
	      * "John Smith <john@smith.com>\n"
	      */
	     printf("%s\n", html_quote("John Smith <john@smith.com>") );

     };

SEE ALSO
     strfunc(3), svect(3), replace(3), limittextwidth(3).

AUTHORS
     Lev Walkin <vlm@lionet.info>

BSD				October 1, 2000				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net