diff options
author | nathansmith <nathansmith@posteo.com> | 2025-05-24 11:52:12 -0600 |
---|---|---|
committer | nathansmith <nathansmith@posteo.com> | 2025-05-24 11:52:12 -0600 |
commit | 1cdfd93e1f02739a685d1cdb131b3efe13adc06b (patch) | |
tree | 0f695f15467a46eb62d079c626870049d3ed03b6 | |
parent | 97264f9fa10c49c4e058fe1f59bb75b04892bee1 (diff) |
No more tables in guest book
-rw-r--r-- | lighttpd-test.conf | 13 | ||||
-rwxr-xr-x | org/cgi-bin/guest-book.cgi | 92 | ||||
-rw-r--r-- | org/css/guest-book.css | 15 | ||||
-rwxr-xr-x | test-server.sh | 2 |
4 files changed, 64 insertions, 58 deletions
diff --git a/lighttpd-test.conf b/lighttpd-test.conf new file mode 100644 index 0000000..03dc5b0 --- /dev/null +++ b/lighttpd-test.conf @@ -0,0 +1,13 @@ +server.document-root = "/home/nathan/Documents/dev/shittyweb/xhtml/" +server.port = 8000 +index-file.names = ("index.xhtml") +server.error-handler-404 = "/error/404.xhtml" + +# Modules +server.modules += ("mod_cgi") + +$HTTP["url"] =~ "^/cgi-bin" { + cgi.assign = ( "" => "" ) +} + +cgi.execute-x-only = "enable"
\ No newline at end of file diff --git a/org/cgi-bin/guest-book.cgi b/org/cgi-bin/guest-book.cgi index bfad47b..4c4d4fd 100755 --- a/org/cgi-bin/guest-book.cgi +++ b/org/cgi-bin/guest-book.cgi @@ -127,77 +127,55 @@ (message (cdr (list-ref guest 1))) (url (cdr (list-ref guest 2))) (name (cdr (list-ref guest 3)))) - (format #t " <table border=\"1\" width=\"60%\">\n\ - <tr><td>\n\ - <b>~a</b> <a href=\"~a\" target=\"_blank\">~a</a> --- signed ~a\n\ - </td></tr>\n\ - <tr><td>\n\ - <p>~a</p>\n\ - </table>\n\n" name url url date message))) + (format #t " <div class=\"container\"> + <b>~a</b> <a href=\"~a\" target=\"_blank\">~a</a> --- signed ~a\n\ + <div class=\"silly-something\"><p>~a</p></div>\n\ + </div>\n <br />\n" name url url date message))) ;; Display pretty much everything (define (display-guest-book) (display "Content-Type: text/html\n\n\ -<!DOCTYPE html>\n\ -<html>\n\ +<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ +\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\ +<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n\ <head>\n\ <title>Guest Book</title>\n\ - <style>\n\ -body {\n\ - color: black;\n\ - background-image: url('../images/guest-book-background.png');\n\ -}\n\ -\n\ -table {\n\ - color: black;\n\ - background-color: #bebebe;\n\ - margin-top: 10px;\n\ - margin-bottom: 10px;\n\ - margin-left: 10px;\n\ - margin-right: 10px;\n\ -}\n\ -</style>\n\ + <link rel=\"icon\" type=\"image/x-icon\" href=\"../images/icon.png\" /> + <link rel=\"stylesheet\" type=\"text/css\" href=\"../css/guest-book.css\" />\n\ </head>\n\ <body>\n\ <a href=\"../index.xhtml\"><img src=\"../images/back_home.png\"\n\ alt=\"Back to home page\"/></a>\n\ - <center>\n\ - <table border=\"1\" width=\"60%\">\n\ - <tr>\n\ - <td>\n\ - <h3>Sign my fucking guest book</h3>\n\ - <form action = \"guest_book.cgi\" method = \"get\">\n\ - <lable for = \"name\" maxlength=\"100\">Name</lable>\n\ - <input type = \"text\" name = \"name\"/>\n\ - <br/>\n\ - <lable for = \"url\" maxlength=\"256\">Website (Optional)\n\ - </lable>\n\ - <input type = \"text\" name = \"url\"/>\n\ - <br/><br/>\n\ - <lable for = \"message\">Write a little silly something</lable>\n\ - <br/>\n\ - <textarea type = \"text\" name = \"message\" rows = \"4\"\n\ - cols = \"40\" maxlength=\"512\"></textarea>\n\ - <br/>\n\ - <input type = \"submit\" value = \"Fucking submit\">\n\ - <b>You can't delete/edit it afterwards</b>\n\ - </form>\n\ - <p>\n\ - <b>Be nice! Dont be a fucking ass.</b>\n\ - </p>\n") + <div class=\"container\">\n\ + <h2>Sign my fucking guest book</h2>\n\ + <form action = \"guest-book.cgi\" method = \"get\">\n\ + <lable for = \"name\" maxlength=\"100\">Name</lable>\n\ + <input type = \"text\" name = \"name\"/>\n\ + <br />\n\ + <lable for = \"url\" maxlength=\"256\">Website (Optional)\n\ + </lable>\n\ + <input type = \"text\" name = \"url\"/>\n\ + <br /><br />\n\ + <lable for = \"message\">Write a little silly something</lable>\n\ + <br />\n\ + <textarea type = \"text\" name = \"message\" rows = \"4\"\n\ + cols = \"40\" maxlength=\"512\"></textarea>\n\ + <br />\n\ + <input type = \"submit\" value = \"Fucking submit\">\n\ + <b>You can't delete/edit it afterwards</b>\n\ + </form>\n\ + <p>\n\ + <b>Be nice! Dont be a fucking ass.</b>\n\ + </p>\n") (handle-fields) - (display " </td>\n\ - </tr>\n\ - </table>\n\n") + (display " </div>\n <br />\n") ;; Try to read the guest book json (with-exception-handler (lambda (error) - (display " <table border=\"1\" width=\"60%\">\n\ - <tr><td>\n\ + (display " <div class=\"container\">\n\ <p>No guest(s) have been added ): But you can be the first!</p>\n\ - </td></tr>\n\ - </table>\n")) + </div>\n")) (lambda () (call-with-input-file guest-book-json-file (lambda (fp) @@ -210,9 +188,7 @@ table {\n\ (guest-loop (- (vector-length guest-book) 1)))))) #:unwind? #t) - (display " </center>\n\ -</body>\n\ -</html>\n")) + (display "</body>\n</html>\n")) (define (main args) (display-guest-book)) diff --git a/org/css/guest-book.css b/org/css/guest-book.css new file mode 100644 index 0000000..9d483b4 --- /dev/null +++ b/org/css/guest-book.css @@ -0,0 +1,15 @@ +body { + background-color: #dcd1ba; + background-image: url('../images/guest-book-background.png'); +} + +.container { + background-color: #bebebe; + width: 60%; + margin: auto; + border: 1px solid black; +} + +.silly-something { + border: 1px dotted black; +} diff --git a/test-server.sh b/test-server.sh new file mode 100755 index 0000000..d8076a1 --- /dev/null +++ b/test-server.sh @@ -0,0 +1,2 @@ +#! /usr/bin/sh +lighttpd -D -f lighttpd-test.conf |