This commit is contained in:
2025-04-15 18:38:03 +08:00
commit 23537c3ae9
12 changed files with 799 additions and 0 deletions

28
userAuth.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef COURSE_DESIGN_USERAUTH_H_
#define COURSE_DESIGN_USERAUTH_H_
#include "sqlite3.h"
#include "tools.h"
using namespace std;
struct UserStruct {
int id;
string username;
string userpassword;
string created_time;
};
void init_user_data(sqlite3 *db);
void register_user(sqlite3 *db, const string &username,
const string &userpassword);
bool login_user(sqlite3 *db, const std::string &username,
const std::string &password);
bool update_user(sqlite3 *db, int id, const string &new_username,
const string &new_password);
vector<UserStruct> get_user_inputs(sqlite3 *db);
bool delete_user(sqlite3 *db, int id);
#endif