#include #include "../tlmpweb/tlmpweb.h" #include "tlmpwebsql.h" static W_SSTRING test ("test","","S"); static W_SSTRING user ("user","","S"); static W_SSTRING passwd ("passwd","","S"); extern "C" void webmain() { FORM_HIDDEN t(test); if (test.cmp("newsession")==0){ // #Specbeg: sample / websession_sql component / new session /* We demonstrate a typical session with a login form. */ ("test"); (user,passwd); tlmpweb_title ("Please log in"); /-

This is a test, enter foo twice

// /- /-
/-
Login ID field_user(); /-
Password field_pass(); return strcmp(user,"foo")==0 && strcmp(pass,"foo")==0; (); tlmpweb_title ("Test session"); /-
url_gotostep (1,"Main menu"); /-

url_gotostep (2,"Who am I"); /-

url_gotostep (3,"logout"); /-

tlmpweb_title ("You are"); printf ("user=%s
\n",user.get()); printf ("pass=%s
\n",passwd.get());
glocal.websession_sql___v1.logout(); url_gotostep (1,"Main menu");
// #Specend: }else if (test.cmp("oldsession")==0){ // #Specbeg: sample / websession_sql component / old session /* Here is a sub-page of an already started session. We are passing true to websession_sql because we want to make sure the session is established. */ ("test",true); tlmpweb_error ("Your session is not active\n\n"); /-
url_self ("test=newsession","Click here to start"); /-
// Session older than 30 seconds are rejected reject = info.since > 30; tlmpweb_title ("You are"); printf ("user=%s
\n",user.get()); printf ("pass=%s
\n",passwd.get());
// #Specend: }else{ tlmpweb_title ("Some tlmpwebsql tests"); url_self ("test=newsession","New session"); /-
url_self ("test=oldsession","Old session"); /-
} }