summaryrefslogtreecommitdiffstats
path: root/captcha.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-01-08 21:21:23 +0900
committerFreeArtMan <dos21h@gmail.com>2015-01-08 21:21:23 +0900
commitad222a30782ebacacd0f5388f01b65fa61e12697 (patch)
tree861e83d3214929fe7d58a0d79dcb0e069bb32b16 /captcha.c
parent3d489fe502178d2d4e58eb8d5736be2fbda38077 (diff)
downloadmicrobbs-ad222a30782ebacacd0f5388f01b65fa61e12697.tar.gz
microbbs-ad222a30782ebacacd0f5388f01b65fa61e12697.zip
Fixed positioning for captcha, motd, mainmenu, sysinfo
Diffstat (limited to 'captcha.c')
-rw-r--r--captcha.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/captcha.c b/captcha.c
index ad614be..97fc7d6 100644
--- a/captcha.c
+++ b/captcha.c
@@ -2,14 +2,31 @@
#ifdef CONFIG_CAPTCHA
-int captcha_test1()
+//ask question if you are bot or not will protect from simplest bots
+//or just any other automatic stuff
+//After captcha used amount of logs reduced, becouse 99% logs before where
+//generated by auto-bot-travelers
+int captcha_test1( term_screen *ts)
{
int ret = 0;
- char s[2];
+ const int s_size = 2;
+ char s[s_size];
+ int column, row;
+ int c;
+
+ //setup terminal output position
+ term_clr_scr( ts );
+ column = term_get_maxcol( ts );
+ row = term_get_maxrow( ts );
+ term_cur_set_c( ts, column/2 );
+ term_cur_set_r( ts, row/2 );
+
+ //just ask question
printf("Are you bot?(y/n):\n");
- fgets(s,2,stdin);
- if ( s[0] == 'n' || s[0] == 'N')
+ c = term_getc( ts );
+ if ( (c == 'n') || ( c == 'N') )
ret = 1;
+
return ret;
}