Update main.c

This commit is contained in:
Blboun3 2024-01-16 16:49:22 +01:00
parent 650e7248fb
commit a1250df57e

33
main.c
View File

@ -91,12 +91,15 @@ void parsePasswordPostData(const char *postData) {
free(dataCopy); free(dataCopy);
} }
/*
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i = 0; i<argc; i++){
*/ printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
/* /*
Main Function Main Function
@ -112,6 +115,26 @@ int main(int c, char **v) {
return 1; return 1;
} }
char *sql;
sql = "CREATE TABLE IF NOT EXISTS Users ( \
UserID TEXT PRIMARY KEY, \
FirstName TEXT NOT NULL, \
LastName TEXT NOT NULL, \
Email TEXT NOT NULL UNIQUE, \
RegistrationDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, \
LastLoginDate TIMESTAMP, \
Notes TEXT \
);";
rc = sqlite3_exec(db, sql, callback, 0, &err_msg);
if( rc != SQLITE_OK) {
fprintf(stderr, "Something happend during processing db tables");
sqlite3_free(&err_msg);
sqlite3_close(db);
return 1;
}
// idk // idk
char *port = c == 1 ? "8000" : v[1]; char *port = c == 1 ? "8000" : v[1];
serve_forever(port); serve_forever(port);