summaryrefslogtreecommitdiff
path: root/captcha.c
blob: 9ee89a8d3f9aa171e610d45561f9ea5b9eb36e3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "captcha.h"

#ifdef CONFIG_CAPTCHA

//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;
	const int s_size = 2;
	char s[s_size];
	int column=0, row=0;
	int c=0;

	//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");
	c = term_getc( ts );
	if ( (c == 'n') || ( c == 'N') )
		ret = 1;

	return ret;
}

#endif