Thanks for this! i am going to use this function in a Authentication class i am going to use.

Will give credit