Serial Number Generator

Discussion in 'PHP' started by Stupidav, Apr 16, 2009.

  1. #1
    I recently created a VB Application that the user will have to register after the trial period with a serial number.

    Once the user enters in the appropriate information on my web page I am want the web page to generate a "Serial Number" from some type of equasion or equasions, that I can verify with my VB app. I initially was thinking something like A+B*C/D=E and a second group doing something simular so that the final result is something along the lines of 00000-00000.

    I have do a little PHP scripting before, but I am not sure exactly where to begin on a script like this.

    Any help is greatly appreciated.
     
    Stupidav, Apr 16, 2009 IP
  2. Random Guy

    Random Guy Peon

    Messages:
    670
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could always go the easy route and just use some wrapping software to handle it, like Armadillo. I think they give you all the coding you'd need to generate numbers.

    It'd probably be easier than coding your own generators :)
     
    Random Guy, Apr 16, 2009 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    You could do it pretty easily with a huge random string stored in a database. Even MD5 could make a usable SN. You do want to make sure that you don't get collisions by checking the numbers against the existing DB, but I think it would be very easy to create.
     
    jestep, Apr 16, 2009 IP
  4. jimbursch

    jimbursch Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I agree with jestep -- do an md5 or SHA hash of a known unique value, like the record id. Maybe tack on a constant to the record id to further obfuscate.
     
    jimbursch, Apr 16, 2009 IP
  5. Stupidav

    Stupidav Guest

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Random Guy............Unfortunatly Armadillo only supports Windows, and so far I have developed it not only for 2000, XP and Vista, but also for Windows Mobile, PPC2003, and Android (G-Phone). with future plans for Mac, Iphone, and Java compatable phones.

    Jestep ........ I though about the DB solution, but my concern is (I am Dreaming here) when 20,000,000 copies are sold I really don't want to have to maintain a DB, and if it is lost for some reason.....

    Although this brings up a good point...... Perhaps I could base it on the purchasers e-mail address. What could I do with thier e-mail address to make it almost impossible for the average user to determine what to do to get around it, and how would I accomplish it with PHP.

    On return from PayPal the users e-mail address is passed to my thankyou page. So from that I could automatically do something with it, right, other than display it
     
    Stupidav, Apr 16, 2009 IP