added: antispam mechanism

each html form has a hidden form_id and counter_id
counter_id on the client side is generated through javascript code
on the server the form_id and counter_id is stored in the session
after sending the html form the server checks the form_id and counter_id




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1116 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-07-02 11:16:36 +00:00
parent 08123fe6ac
commit 1c05c31721
22 changed files with 337 additions and 15 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
#include <vector>
#include <string>
#include <ctime>
#include <map>
#include "item.h"
#include "error.h"
#include "user.h"
@@ -55,6 +56,7 @@ namespace Winix
struct Session
{
Session();
Session(const Session & ses);
Session & operator=(const Session & ses);
@@ -99,13 +101,6 @@ struct Session
bool remember_me;
// rebus - set by rebus_question(Info & i) from templates
Rebus::Item * rebus_item;
bool rebus_checked;
int spam_score;
// if true then this session will be removed by SessionManager
// without checking the time expiration
bool remove_me;
@@ -127,6 +122,17 @@ struct Session
// (it can be null)
IPBan * ip_ban;
// rebus - set by rebus_question(Info & i) from templates
Rebus::Item * rebus_item;
bool rebus_checked;
int spam_score;
std::map<long, long> antispan;
};