diff --git a/htdocs/archive/report.c b/htdocs/archive/report.c new file mode 100644 index 000000000..464033d6e --- /dev/null +++ b/htdocs/archive/report.c @@ -0,0 +1,20 @@ + +#include + +int main() { + char line[4096] = {0}; + printf("Content-type: text/plain\n\n"); + + FILE *f = fopen("data.txt", "rt"); + if (f) { + int c; + while (EOF != (c = fgetc(f))) + printf("%c", c); + fclose(f); + } else { + printf("failed to open data\n"); + } + + return 0; +} + diff --git a/htdocs/archive/submit.c b/htdocs/archive/submit.c new file mode 100644 index 000000000..2ef3b81aa --- /dev/null +++ b/htdocs/archive/submit.c @@ -0,0 +1,46 @@ +#include +#include +#include + +static void unencode(const char *src, char *dest) +{ + for (; *src; src++, dest++) { + if (*src == '+') + *dest = ' '; + else if (*src == '%') { + int code; + if (sscanf(src+1, "%2x", &code) != 1) + code = '?'; + *dest = code; + src += 2; + } else + *dest = *src; + } + *dest = '\0'; +} + +int main() +{ + const char *query_string = getenv("QUERY_STRING"); + if (query_string == NULL) { + printf("Content-type: text/plain\n\n"); + printf("empty/invalid data\n"); + } else if (strlen(query_string) > 1024) { + printf("Content-type: text/plain\n\n"); + printf("data size limit exceeded (1024)\n"); + } else { + char data[4096] = {0}; + unencode(query_string, data); + + FILE *f = fopen("data.txt", "a"); + fprintf(f,"%s\n",data); + fclose(f); + + printf("Content-type: text/plain\n\n"); + printf("saved\n"); + } + + return EXIT_SUCCESS; +} + + diff --git a/htdocs/archive/submitfile.html b/htdocs/archive/submitfile.html new file mode 100644 index 000000000..2fcfd6231 --- /dev/null +++ b/htdocs/archive/submitfile.html @@ -0,0 +1,22 @@ + + + + +

Submit file

+ +
+ +Name:
+ + +

+Copy/paste the file data:
+ + +

+ +
+ + + +