Created
March 11, 2013 12:34
-
-
Save ChristianGaertner/5133944 to your computer and use it in GitHub Desktop.
Simple AuthCode Generator. You can save the generated code in a database and send the code to the user. Then you can use this string to validate an email or anything you want.
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
$string = "abcdefghijklmnopqrstuvwxyz0123456789"; //add as many diffrent char you need, this is the char pool. | |
//auth code will be 25 chars long | |
for($i=0;$i<25;$i++){ | |
$pos = rand(0,36); | |
$authCode .= $string{$pos}; | |
} | |
echo $authCode; //optional |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment