diff --git a/login.h b/login.h new file mode 100644 index 0000000..da873f6 --- /dev/null +++ b/login.h @@ -0,0 +1,70 @@ +#include +#include +//#include +//#include + +using namespace std; + +string inputText; + +// function inputLogin gets the +// input of the user +string inputLogin(string inputText) +{ + string input; + + cout << "Enter your " + inputText + ": " << endl; + cin >> input; + + return input; +} + +// function login uses the inputLogin function and +// uses it to get the username and password input +// for each user and also checks if the users exist +// in the database +string login() +{ + string username = "username"; + + string usernameInput = inputLogin(username); + + //sqlite3* db; + + //sqlite3_open("Timetablex.db", &db); + + //auto checkingUsername = db("SELECT * FROM Account WHERE (AccountName = " + usernameInput + ";"); + + //if (checkingUsername = NULL) + //{ + // cout << "This username doesn't exist. Try a different username."; + + // return "Restart the program"; + //} + //else + //{ + string password = "password"; + + string passwordInput = inputLogin(password); + + /* auto checkingPassword = db("SELECT * FROM Account WHERE (password = " + passwordInput + ";"); + + sqlite3_close(); + + if (checkingPassword = NULL) + { + cout << "This password doesn't exist. Try a different password."; + + return "Restart the program"; + } + else + {*/ + system("CLS"); + + return usernameInput; + // } + + + //} + +};