donate: add monetary link - randomcrap - random crap programs of varying quality
 (HTM) git clone git://git.codemadness.org/randomcrap
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f4c0d6bb674144c7e6e427a79ade01b9675311b2
 (DIR) parent 8dc3054b2de49534bba2d74d818b44e1187652ad
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat, 14 Sep 2024 18:18:57 +0200
       
       donate: add monetary link
       
       Diffstat:
         M donations-cgi/index.html            |       7 ++++---
         M donations-cgi/main.c                |      12 ++++++++++--
         M donations-cgi/testsuite.sh          |       1 -
       
       3 files changed, 14 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/donations-cgi/index.html b/donations-cgi/index.html
       @@ -25,9 +25,10 @@ textarea, input {
        </p>
        
        <p>
       -<input type="radio" name="type" id="compliment" value="c" selected /><label for="compliment">A nice compliment</label>
       -<input type="radio" name="type" id="hate" value="h" /><label for="hate">Pure hatred</label>
       -<input type="radio" name="type" id="joke" value="j" /><label for="joke">A joke</label>
       +<input type="radio" name="type" id="compliment" value="c" selected /> <label for="compliment">A nice compliment</label>
       +<input type="radio" name="type" id="hate" value="h" /> <label for="hate">Pure hatred</label>
       +<input type="radio" name="type" id="joke" value="j" /> <label for="joke">A joke</label>
       +<input type="radio" name="type" id="million" value="m" /> <label for="million">One million dollars</label>
        </p>
        
        <p>
 (DIR) diff --git a/donations-cgi/main.c b/donations-cgi/main.c
       @@ -119,7 +119,7 @@ main(void)
                valid = 0;
                if ((p = getparam(query, "type"))) {
                        r = decodeparam(_type, sizeof(_type), p);
       -                if (r != -1 && (_type[0] == 'c' || _type[0] == 'h' || _type[0] == 'j'))
       +                if (r != -1 && (_type[0] == 'c' || _type[0] == 'h' || _type[0] == 'j' || _type[0] == 'm'))
                                valid = 1;
                }
                if (!valid)
       @@ -162,10 +162,18 @@ main(void)
                fputs(msg, fp);
                fclose(fp);
        
       -        fputs("Status: 200 OK\r\n", stdout);
       +        if (_type[0] == 'm') {
       +                fputs("Status: 302 Found\r\n", stdout);
       +
       +                fputs("Location: https://www.codemadness.org/downloads/1_million_dollars.webm\r\n", stdout);
       +        } else {
       +                fputs("Status: 200 OK\r\n", stdout);
       +        }
       +
                fputs("Content-Type: text/plain\r\n", stdout);
                fputs("\r\n", stdout);
                fputs("Thank you for your donation!\n", stdout);
       +        return 0;
        
                return 0;
        }
 (DIR) diff --git a/donations-cgi/testsuite.sh b/donations-cgi/testsuite.sh
       @@ -1,3 +1,2 @@
        #!/bin/sh
       -# enterprise testsuite, 101.234% code coverage
        QUERY_STRING="?captcha=yes&type=j&msg=a&pay=1" ./main