<?php

// usage   dea_licence.php?serialno=1631770198&expiry=20/01/2012


//	include "library.php";

//	$cxn = start_code( true );


        $serialno = $_GET['serialno'];
        $expiry = $_GET['expiry'];

        $licence_renewal_30days = 9384618422;
        $licence_renewal_12months = 9737472394;

        $tm_mday = substr($expiry,0,2);
        $tm_mon = substr($expiry,3,2)-1;
        $tm_year = substr($expiry,8,2)+100;

        $licence_key1 = $tm_mday * ($tm_mon+1) * ($tm_year - 100 + 2000) * $serialno * $licence_renewal_30days;

	$licence_key2 = $tm_mday * ($tm_mon+1) * ($tm_year - 100 + 2000) * $serialno * $licence_renewal_12months;

	$str_licence_key1 = sprintf( "%12.0f", $licence_key1 );
	$str_licence_key2 = sprintf( "%12.0f", $licence_key2 );

        $str_licence_key1 = substr( $str_licence_key1, 0, 12 );
        $str_licence_key2 = substr( $str_licence_key2, 0, 12 );


        echo "usage   dea_licence.php?serialno=1631770198&expiry=20/01/2012<br><br>";

        echo "30 day key ".$str_licence_key1."<br><br>";
        echo "1 year key ".$str_licence_key2."<br><br>";

?>

