Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Timetablex/login.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
70 lines (49 sloc)
1.31 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
// } | |
//} | |
}; |