Quote:
Originally Posted by Redcoder
For the serial number....A suggestion would be to take the MD5 hash of the timestamp - time() - then take the first 15 characters of the generated hash and separate every 2 characters using hyphens. Although this increases the chances of collision, it is a viable method of generating Serial Numbers.
|
Something like this, this is something i made but it isn't very good.
PHP Code:
<!DOCTYPE html>
<html>
<head>
<title>DigiChat Serial Generator</title>
</head>
<body>
<form action="?" method="get"><b>Company Name: </b><input
type="text" name="CompanyName" /><br/>
<input type="submit" value="Generate" /> </form> <p>
<br/>
<b>Company Name:</b>
<br/><?php echo isset($_GET['CompanyName']) ? htmlspecialchars($_GET['CompanyName']) : ''; ?>
<br/>
<b>Order Numbers:</b>
<br/>
<?php
// This part is buggy, I will fix it later.
$input = array("400904015", "842922074", "614975264", "945558183", "617697462" );
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
?>
<br/>
<b>Serial Numbers:</b>
<br/>
<?php
// This part is buggy, I will fix it later.
$input = array("DC-770-06278-GH-548", "DC-591-67799-FQ-593", "DC-631-32024-GL-281", "DC-736-91659-GB-
403", "DC-590-34096-FM-230" );
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
?>
<br/>
<b>Order Numbers:</b>
<br/>
<?php
// This part is buggy, I will fix it later.
$input = array("121749811100001023", "116778905500001023", "117761126300001023", "126703411100001023",
"128687615900001023" );
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
?>
<br/>
<b>Key:</b>
<br/>
<?php
// This part is buggy, I will fix it later.
$input = array("DC-029-0000102308382", "DC-274-0000102308382", "DC-284-0000102308382", "DC-033-
0000102308382", "DC-280-0000102308382" );
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
?>
<br/>
</body>
</html>
If someone can take it and re-write it to be a cleaner version that would be awesome! Also, is their a way that when they enter in the company name the results of the serials will THEN show up? So it will just show the input box and the generate button, then when they type in a company name and then hit generate, then the rest of the serial will be displayed. like i showed in the first post?