best practice to generate random token for forgot password
In PHP, use random_bytes(). Reason: your are seeking the way to get a password reminder token, and, if it is a one-time login credentials, then you actually have a data to protect (which is – whole user account) So, the code will be as follows: //$length = 78 etc $token = bin2hex(random_bytes($length)); Update: previous versions … Read more