Version 5 of tclhttpd 2ch-forums

Updated 2006-04-10 13:16:14

Tips for creating NiChannel style forum software implemented in TclHttpd.


Generating captcha images (http://www.captcha.net ) for anti-spam purposes.

Using ImageMagick convert routine, where the captcha code is RKS876:

   convert captcha.png -gravity center -pointsize 24 -fill white -annotate 0 'RKS876' -swirl 90 captcha-done.png

Using a random sequence of numbers and letters for the captcha code.

   proc randomCode {size} {
      set data [list 1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
      set code [list]
      for {set n 0} {$n < $size} {incr n} {
        lappend code [lindex $data [expr {int(rand()*[llength $data])}]]
      }
      return [join $code ""]
    }