public void LoginButton()
    {
        Debug.Log($"internetReachability= {Application.internetReachability}");

        if ((Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork ||
             Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) &&
            InternetAvailable.internetAvailableStatic
            )
        {
            if (SQLHandler.pushingStack.Count != 0)
            {
                SQLHandler.CheckConnection();
                SQLHandler.RunCommand(SQLHandler.pushingStack.Pop());
            }

            StartCoroutine(PHPRequestRecievedCoroutine());
        }
        else
        {
            // offline mode
            var offlineUsername = user.text.Trim();
            var offlinePassword = password.text.Trim();

            var loginSuccess = offlineUserDatabase.Matches(offlineUsername, offlinePassword);

            if (loginSuccess)
            {
                SceneManager.LoadScene("Menu");
            }
            else
            {
                Debug.Log("Unsuccessful offline login");
                incorrectLoginText.text = stringIncorrectLogin;
            }
        }
        //exists = rows[0][0].Equals("1");
        //print(exists);
        //if(exists)
        //{
        //    //get permissions
        //    //command = string.Format("select canUse from CARE1.users_old where user = '******'", userText);
        //    //rows = SQLHandler.RunCommand(command);

        //    //SQLHandler.CloseConnection();

        //    command = string.Format("select user_id from CARE1.users where email = '{0}' and password = '******' limit 0, 1",
        //                                userText, passText);

        //    rows = SQLHandler.RunCommand(command);

        //    Settings.userID = Convert.ToInt32(rows[0][0]);

        //    Settings.hasPermissions = exists;

        //    print(Settings.hasPermissions + " has permission");

        //    SceneManager.LoadScene("Menu");
        //}
    }
    public IEnumerator PHPRequestRecievedCoroutine()
    {
        loginButton.interactable = false;
        string userText = user.text;
        string passText = password.text;

        bool exists = false;

        //using (MD5 md5Hash = MD5.Create())
        //{
        //    passText = GetMd5Hash(md5Hash, salt + password.text);
        //}
        SQLHandler.CheckConnection();
        string command                       = string.Format("SELECT password FROM university.users where email = '{0}'", userText);
        List <List <string> > rows           = SQLHandler.RunCommand(command);
        string commandStatus                 = string.Format("SELECT status FROM university.users where email = '{0}'", userText);
        List <List <string> > statusReturned = SQLHandler.RunCommand(commandStatus);


        string passhash = "";

        if (rows.Count != 0)
        {
            passhash = rows[0][0];
        }

        yield return(StartCoroutine(GetPHPRequest(passText, passhash)));

        if (!passhash.Equals("") && responseBool && statusReturned[0][0].Equals("active"))
        {
            command = string.Format(
                "select uuid from university.users where email = '{0}' and password = '******' limit 0,1", userText,
                passhash);
            rows = SQLHandler.RunCommand(command);

            Settings.userID         = rows[0][0];
            Settings.hasPermissions = true;
            // sets incorrecLoginText to an empty string in case the text displayed message upon returning to login screen
            incorrectLoginText.text = "";
            responseBool            = false;
            runningPHPBool          = false;
            loadingImage.SetActive(false);
            loadingText.SetActive(false);
            loginButton.interactable = true;
            SceneManager.LoadScene("Menu");
        }
        else if (!passhash.Equals("") && responseBool && statusReturned[0][0].Equals("deactivate"))
        {
            user.text      = "account inactive; Please contact support";
            runningPHPBool = false;
            loadingImage.SetActive(false);
            loadingText.SetActive(false);
            loginButton.interactable = true;
        }
        else     /*
                  * user.text = "Incorrect login";
                  * password.text = "";
                  */
        // displays message if the login information is incorrect
        {
            runningPHPBool          = false;
            incorrectLoginText.text = stringIncorrectLogin;
            responseBool            = false;
            loadingImage.SetActive(false);
            loadingText.SetActive(false);
            loginButton.interactable = true;
        }
    }