Verify serial compliant date

Asked

Viewed 143 times

-5

A doubt I have about the completion of the month, according to the serial number filled.

Logic is in the 4th and 5th license digits, which are a hexadecimal number

Example : 0AC192F4B16EA6A5CE

  • The number 19, means it will win on 30/01/2018
  • The number 1A, means it will win on 02/28/2018
  • The number 1B, means it will win on 30/03/2018

My doubt is the following, it is possible a php rule or some script that can fill in the month when inserting the license in the form field?

  • I think so, you play the known values in an array and then compare and display.... You have started something ?

  • 1

    I imagine you have a calculation there to define the due date of leave only the 19/1A or 1B is not enough to discover.

  • In SQL-SERVER it would look like this: SELECT DATEADD(Month, o_numero_hexa_em_decimal, '2015-12-30'); equals due date.

  • @Bacco what I’m doing is a customer registration, we resale an ERP system for trade, and the company does not give me how it generated the password, only informed me how to find the month of expiration in the license, then what I am in doubt if I use the array to read the 4th and 5th key number so xxx19xxxxxxxxxxx. I’m sorry to misunderstood the question in phomrulation

  • The key is created with customer CNPJ information + the order month and the equipment serial number. What I’m doing is a check of my salaries in the month, generating a report

1 answer

5


If you want to know the date, that’s all it takes:

function VencimentoSerial($serial) {
   $vencto = strtotime( '2016-1-1 +'.hexdec(substr($serial, 3, 2)).' months last day');
   return gmdate( 'd/m/Y', $vencto);
}

See working on IDEONE.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.