Skip to content

Instantly share code, notes, and snippets.

@ChristianGaertner
Created March 11, 2013 12:34
Show Gist options
  • Save ChristianGaertner/5133944 to your computer and use it in GitHub Desktop.
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.
$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