25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

* tools/captcha.sh: sample CAPTCHA script.

SVN Revision: 1993
This commit is contained in:
Evgeniy Khramtsov 2009-03-13 16:38:28 +00:00
parent 3834bcc07e
commit 9aadefa5b0
2 changed files with 22 additions and 0 deletions

View File

@ -7,6 +7,7 @@
* src/web/ejabberd_http.erl: likewise.
* src/mod_muc/mod_muc_room.erl: CAPTCHA support.
* src/mod_muc/mod_muc_room.hrl: likewise.
* tools/captcha.sh: sample CAPTCHA script.
2009-03-10 Badlop <badlop@process-one.net>

21
tools/captcha.sh Executable file
View File

@ -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:-