Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <xramtsov@gmail.com>2009-03-13 19:38:28 +0300
committerEvgeniy Khramtsov <xramtsov@gmail.com>2009-03-13 19:38:28 +0300
commit9aadefa5b031fe4cef4e8d8716b1cee05929b8b0 (patch)
tree5134b4496615ae5ffab089c339df389069214e92 /tools
parent3834bcc07e71249e20f9f17c91626b6df9491758 (diff)
* tools/captcha.sh: sample CAPTCHA script.
SVN Revision: 1993
Diffstat (limited to 'tools')
-rwxr-xr-xtools/captcha.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/captcha.sh b/tools/captcha.sh
new file mode 100755
index 000000000..2b18d93ad
--- /dev/null
+++ b/tools/captcha.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+SIGN=$(($RANDOM % 2))
+
+R1=$(($RANDOM % 20))
+R2=$(($RANDOM % 10 + 40))
+
+if [ $SIGN -eq "0" ]; then
+ S1=$(( -1*($RANDOM % 20 + 50) ))
+ S2=$(( $RANDOM % 20 + 50 ))
+else
+ S2=$(( -1*($RANDOM % 20 + 50) ))
+ S1=$(( $RANDOM % 20 + 50 ))
+fi
+
+convert -size 140x60 xc:white \
+ -pointsize 30 -draw "text 20,30 '$1'" \
+ -roll -$R2+$R1 -swirl $S1 \
+ -roll +$R2-$R1 -swirl $S2 \
+ +repage -resize 120x60 \
+ -quality 90 -depth 8 png:-