Cookies are bits of information that web-based applications can store in the browser. Applications can set cookie values then retrieve and modify those values later.
Auto-AuthenticationCookies are commonly used to store authentication information so a user won't have to log in to a web-based application each time they want to use it. The first time the user logs in, the application sets a cookie. Subsequent times, the application finds the cookie and lets the user in automatically.
The http class provides the setCookie method for setting the value of a cookie.
#include <groundwork/http.h>
#include <groundwork/cgimodule.h>
MAIN {
http *h=new http(APISTRUCT);
// send the content type
h->contentType("text","html",NULL);
... get the username and password ...
// set some cookies
h->setCookie("username",username,NULL,NULL,NULL,0);
h->setCookie("password",password,NULL,NULL,NULL,0);
h->setCookie("loggedin","yes",NULL,NULL,NULL,0);
// terminate the header
h->cr();
... send some data ...
delete h;
}