| 29 | } |
| 30 | |
| 31 | void LogRequest( const string& username, const string& ip, const string& request ) |
| 32 | { |
| 33 | try { |
| 34 | auto timestamp = std::to_string( time( nullptr ) ); |
| 35 | |
| 36 | db << |
| 37 | "create table if not exists log_request (" |
| 38 | " _id integer primary key autoincrement not null," |
| 39 | " username text," |
| 40 | " timestamp text," |
| 41 | " ip text," |
| 42 | " request text" |
| 43 | ");"; |
| 44 | db << "INSERT INTO log_request (username, timestamp, ip, request) VALUES (?,?,?,?);" |
| 45 | << username |
| 46 | << timestamp |
| 47 | << ip |
| 48 | << request; |
| 49 | } catch ( const std::exception& e ) { |
| 50 | std::cout << e.what() << std::endl; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | bool TestData( void ) { |
| 55 | try { |