Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    117
    Thanks
    27
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jan 2011
    Posts
    117
    Thanks
    27
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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.

  • #5
    Regular Coder
    Join Date
    Jan 2011
    Posts
    117
    Thanks
    27
    Thanked 0 Times in 0 Posts
    Lol, no thanks. Got what I needed, just didn't want to do it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •