SYNOPSIS#include "cgi.h"
int cgigetstate(cp, name, val)
CGI *cp;
char **name, **val;
DESCRIPTION
The cgigetstate()
function sets name
and val
to
point to the name and value of the (encrypted) state variable cookie.
These strings are owned by the API and should not be modified or
freed. The cookie can then be printed with htpf("%U")
as a URL
or form variable in the output to propagate the state variables.
cgigetstate()
returns 1 if ok; 2 if the state was already
successfully printed as a cookie (and hence need not be printed); or 0
on error.
The returned value only needs to be printed as a variable (e.g. sent
in the query string of an URL, or a hidden var in a form) if the
current Web browser does not support cookies, i.e. if 1 is returned (or
cgiwritestate()
returned -1). Normally cgiwritestate()
prints the state cookie if it recognizes the browser as
cookie-compatible.
CAVEATS
If used, cgigetstate()
should be called after any call to
cgiwritestate()
, so that the latest state cookie is obtained.
SEE ALSOcgiwritestate()