Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-30-2012, 08:50 PM   PM User | #1
xxcorrosionxx
Regular Coder

 
Join Date: Jan 2011
Posts: 117
Thanks: 27
Thanked 0 Times in 0 Posts
xxcorrosionxx is an unknown quantity at this point
Question [Help] Php Serial Generator

I was hoping someone can take some time out to code me a php serial generator for free. I would really appreciate it.

The serial numbers should display the output like this once generated:

Company Name: Pazder

Order Number: 1382263

Serial Number: DC-387-05546-FU-194

Order Number: 214748262502306047

Key: DC-429-0209510309209

But, i would like people to be able to insert their own company name, so when the serials are generated it will show their company name along with the serial. If someone could put it in the format on how i have it displayed up top it would be much appreciated.

Kindest Regards,
xxcorrosionxx
xxcorrosionxx is offline   Reply With Quote
Old 10-31-2012, 12:35 AM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
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.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 10-31-2012, 12:50 PM   PM User | #3
xxcorrosionxx
Regular Coder

 
Join Date: Jan 2011
Posts: 117
Thanks: 27
Thanked 0 Times in 0 Posts
xxcorrosionxx is an unknown quantity at this point
Quote:
Originally Posted by Redcoder View Post
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($input2);
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($input2);
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($input2);
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($input2);
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?
xxcorrosionxx is offline   Reply With Quote
Old 10-31-2012, 06:11 PM   PM User | #4
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
To a cleaner version? That means that it works but you want clean code...right? Or you just want it done better. You should probably post it in the Job and Web projects forum. You can get somebody to do it faster for you for a small fee.

Or just wait for somebody to do it all for you...just wait...just wait.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Old 10-31-2012, 06:32 PM   PM User | #5
xxcorrosionxx
Regular Coder

 
Join Date: Jan 2011
Posts: 117
Thanks: 27
Thanked 0 Times in 0 Posts
xxcorrosionxx is an unknown quantity at this point
Lol, no thanks. Got what I needed, just didn't want to do it.
xxcorrosionxx is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:43 PM.


Advertisement
Log in to turn off these ads.