Skip to content

Instantly share code, notes, and snippets.

@Danjavia
Created November 12, 2013 15:20
Show Gist options
  • Save Danjavia/7432622 to your computer and use it in GitHub Desktop.
Save Danjavia/7432622 to your computer and use it in GitHub Desktop.
Generate A random key
// Serial Key Generator
$pool = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$countPool = count( $pool ) ;
$totalChars = 12 ;
$pass = '' ;
for ( $i = 0 ; $i < $totalChars ; $i++ ) {
$currIndex = mt_rand( 0, $countPool ) ;
$currChar = $pool[ $currIndex ] ;
$pass .= $currChar ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment