int resetlog_cgi(HttpState *state) { count = 0; clear_log(); cgi_redirectto(state, REDIRECTTO); return 0; }
int led4toggle(HttpState* state) { if('\0' == state->cookie[0]) { cgi_redirectto(state,REGISTERFORM); return 0; } if (strcmp(led4,"ledon.gif")==0) strcpy(led4,"ledoff.gif"); else strcpy(led4,"ledon.gif"); add_audit(state, 4); cgi_redirectto(state,REDIRECTTO); return 0; }
int led_toggle8(HttpState* state) { if (strcmp(led_DS8,"ledon.gif")==0) strcpy(led_DS8,"ledoff.gif"); else strcpy(led_DS8,"ledon.gif"); cgi_redirectto(state,REDIRECTTO); return 0; }
int led4toggle(HttpState* state) { if (strcmp(led4,"ledon.gif")==0) { strcpy(led4,"ledoff.gif"); } else { strcpy(led4,"ledon.gif"); } cgi_redirectto(state,REDIRECTTO); return 0; }
int set_date(HttpState* state) { auto struct tm time; if (state->cancel) { return 1; } time.tm_sec=second; time.tm_min=minute; time.tm_hour=hour; time.tm_mon=month; time.tm_mday=day; time.tm_year=year-1900; tm_wr(&time); SEC_TIMER=mktime(&time); date_lock=0; cgi_redirectto(state,REDIRECTTO); return 0; }
/* * Accept the new email and display it to the LCD. */ int Submit(HttpState* state) { if (state->length) { /* buffer to write out */ if (state->offset < state->length) { state->offset += sock_fastwrite(&state->s, state->buffer + (int)state->offset, (int)state->length - (int)state->offset); } else { state->offset = 0; state->length = 0; } } else { switch (state->substate) { case 0: /* init the FORMSpec data */ FORMSpec[0].value[0] = '\0'; FORMSpec[1].value[0] = '\0'; FORMSpec[2].value[0] = '\0'; state->p = state->buffer; state->substate++; break; case 1: /* parse the POST information */ if (ParsePost(state) != -1) { // Add the email to the email list if (AddEmail(emailTemp.from, emailTemp.subject, emailTemp.body) != -1) { state->substate++; } else { // Failed to add the email state->substate = 10; } } else { // Failed to parse the new email state->substate = 10; } break; case 2: state->substate = 0; cgi_redirectto(state,REDIRECTTO); break; // This case only occurs when there has been an error case 10: strcpy(state->buffer, "HTTP/1.0 200 OK\r\n\r\n"); state->length = strlen(state->buffer); state->offset = 0; state->substate++; break; case 11: strcpy(state->buffer, "<HTML><HEAD><TITLE>Email Failed!</TITLE></HEAD><BODY><H1>Email failed!</H1>\r\n"); state->length = strlen(state->buffer); state->substate++; break; case 12: strcpy(state->buffer, "<P><A HREF=\"/\">Back to main page</A></BODY></HTML>\r\n"); state->length = strlen(state->buffer); state->substate++; break; default: state->substate = 0; return 1; } } return 0; }