Well, you could produce those randomly. Store all the PINs to a database and before storing compare that it doesn't exist yet. Here is a piece of code to produce PINs in _exactly_ that format you want. I've done it for myself, but feel free to use it in any way you like:
<? srand((double) microtime() * 1000000); for ($i=0; $i < 3; $i++) { // $i < 3 tells you how many 'parts' there should be for ($n=0; $n < 5; $n++) { // $n < 5 tells you how many chars there is in each part $nType = rand(1,3); if ($nType == 1) // A number between 0 - 9 $strChar = rand(0,9); elseif ($nType == 2) { // A small letter between a - z $strChar = chr(rand(65,90)); } elseif ($nType == 3) { // A capital letter between A - Z $strChar = chr(rand(97,122)); }; $strCode .= $strChar; }; // If it ain't the last part, add the separator char if ($i != 2) $strCode .= "-"; }; ?> Niklas -----Original Message----- From: Alvin Tan [mailto:[EMAIL PROTECTED]] Sent: 14. toukokuuta 2002 7:13 To: [EMAIL PROTECTED] Subject: [PHP] Generating PINs Hi All, This is not really a PHP question, but seeing that the final application will be in PHP, I figured this'll be the best place to start. I have a client who wants to release a unique PIN for each product they sell which works as a key to get more goodies on the website. How/where can I get a large number of PINs, much like a software key (e.g. 3HH5R-E59VB-7SX99 or similar)? TIA @lvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php