Skip to content
Permalink
Browse files
Create login.h
  • Loading branch information
borgessa committed Dec 9, 2019
1 parent 7c6e961 commit cdf47a18418ef0b1256166399a7c8ba8afc4dd99
Showing 1 changed file with 70 additions and 0 deletions.
70 login.h
@@ -0,0 +1,70 @@
#include <iostream>
#include <stdlib.h>
//#include <fstream>
//#include <winsqlite/winsqlite3.h>

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;
// }


//}

};

0 comments on commit cdf47a1

Please sign in to comment.