diff --git a/InGameMenu.cpp b/InGameMenu.cpp index dda5303..2069b26 100644 --- a/InGameMenu.cpp +++ b/InGameMenu.cpp @@ -20,7 +20,7 @@ public: - + //method to change the password void changePassword(int Player_ID, sqlite::sqlite &db ) { newpass: @@ -73,8 +73,8 @@ cout << "Input your favourite club"<< endl; cin>> favourite_club; - // updting edtails on BD - //sqlite::sqlite db( "ball.sqlite" ); + // updting details on BD + auto cur = db.get_statement(); cur->set_sql( " UPDATE Player SET Email = ? , Mentality = ? , Age = ? , Nationality = ? , Club = ? WHERE Player_ID = ? ; " ); cur->prepare(); @@ -99,10 +99,9 @@ } // end updateDetails // sqlite::sqlite &db + // geting the details from the database and show void printDetails(int Player_ID, sqlite::sqlite &db) { - // showing details from the user - //sqlite::sqlite db( "ball.sqlite" ); auto cur = db.get_statement(); cur->set_sql( " SELECT * FROM Player WHERE Player_ID = ? ; " ); cur->prepare(); @@ -123,7 +122,7 @@ } - } + }// end printDetails };// end clas PlayerInfo @@ -156,19 +155,22 @@ case '1': { - + cout<< "Not available yet..."<< endl ; + goto MenuInGame; break; } // end case 1 play game case '2': { - + cout<< "Not available yet..."<< endl ; + goto MenuInGame; break; }//end case 2 my team case '3':{ - cout << "Market BallManager"<< endl; + cout<< "Not available yet..."<< endl ; + goto MenuInGame; break; }// end case 3 market @@ -231,7 +233,7 @@ return 0; - }// end of menu + }// end of menuSettings break; } // end Menu Setings diff --git a/Main.cpp b/Main.cpp index f92d3d1..4844b42 100644 --- a/Main.cpp +++ b/Main.cpp @@ -8,7 +8,7 @@ using namespace std; #include "libsqlite.hpp" #include "Menu.cpp" - +// this the main part, my plan was to connect the code from everyone here, i think its the best way to do it int main() { @@ -18,7 +18,8 @@ int main() //PlayerInfo pi; //pi.changePassword(7, db ); //return 0; - + + int Player_ID = menuu(); diff --git a/Menu.cpp b/Menu.cpp index e0ddf91..8991ed2 100644 --- a/Menu.cpp +++ b/Menu.cpp @@ -12,7 +12,7 @@ using namespace std; #include "md5.h" -// this funcition to ecrypt the password, i did some research on internet, is not mine. +// this funcition to encrypt the password, i did some research on internet, is not mine. string hashPassword(string password) { string ecryptedPassword; @@ -21,6 +21,8 @@ string hashPassword(string password) return ecryptedPassword; } + +// this funcition is simply to insert into the database ( creates the team for each player when registing) int createTeam(int Player_ID, string teamName ) { @@ -93,7 +95,7 @@ char menuu() if (result == true){ cout<<"login Sucessful"<step(); if (result == true) { - cout<<"The username or email are already in use! Try Again"<step(); cout<<"Registed Sucessful"<set_sql( "SELECT Player_ID FROM Player " "WHERE UserName = ? AND Password = ?;" ); @@ -179,7 +181,7 @@ char menuu() cur->bind( 2, password ); int result= cur->step(); int Player_ID = cur->get_int(0); - //sqlite::sqlite3_close(db); + cur = NULL; createTeam(Player_ID,teamName); // create the team for the player (inserting in dabase) // end of getting the ID diff --git a/README.md b/README.md index b750f78..c84f229 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ g++ --std=c++14 Main.cpp md5.cpp -o HAS -lsqlite3 -o main_program && ./main_prog g++ pass.cpp md5.cpp -o main_program && ./main_program -g++ ncurses.cpp -lncurses +