]> git.plutz.net Git - httpchat/blobdiff - index.cgi
improved nick handling, allow disabling registration
[httpchat] / index.cgi
index ff9e563f356689f95115ddb1aaac6f4f4df42bbe..ac9a110149f9e8b79a992b946b4cd6321c2df85c 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -12,6 +12,12 @@ LOCATION="$(PATH "$PATH_INFO")"
 LOCATION="${LOCATION#/}"
 LOCATION="${LOCATION%%/*}"
 
+NICK_REGISTRATION="${NICK_REGISTRATION:-on}"
+
+# ToDo:
+# COOKIE_NICK_EXPIRE=$((86400 * 14))
+# REGEISTERED_NICK_EXPIRE=$((86400 * 365))
+
 yield_page(){
   page="$1"
   printf '%s\r\n' 'Content-Type: text/html; charset=utf-8' \
@@ -42,9 +48,9 @@ settings_menu(){
   fi
   printf '
       [a .section href="#nick" Nickname]
-      [div #nick [input name="nickname" value="%s"][submit "action" "nick" Set Cookie]]
+      [div #nick [input name="nickname" placeholder="%s"][submit "action" "nick" Set Cookie]]
   ' "$(HTML "${nickname#\?}")"
-  printf '
+  [ "$NICK_REGISTRATION" = on -a "$nickname" != '?Guest' ] && printf '
       [a .section href="#register" Register Nickname]
       [div #register
         [p Registration will set a permanent Cookie in your Browser.