Topic: Get HDD serial number and authentication scripts for rent License.

Hi, Bellow script is for PHP.
I want to create a script like this by My Visual Database which I want to apply for my project.
Please help me...



// this is for HDD authentication//

function GetVolumeLabel($drive) {
if (preg_match('#Volume Serial Number is (.*)\n#i', shell_exec('dir '.$drive.':'), $m)) {
$volname = ' ('.$m[1].')';
} else {
$volname = '';
}
return $volname;
}
$serial = str_replace("(","",str_replace(")","",GetVolumeLabel("c")));

echo "HDD No is:" .$serial. "<br>";

// Condition
$MyHDD = " BC3A-9B56";
if ($serial == $MyHDD) {
    //echo 'true';
} else {
     header('location: ---.com');
                exit();
}
// Authentication for usage date

$Lic_day = 30;
$start  = date_create('2021-04-26');
$end     = date_create(); // Current time and date
$diff      = date_diff( $start, $end );
/*
echo 'The difference is ';
echo  $diff->y . ' years, ';
echo  $diff->m . ' months, ';
echo  $diff->d . ' days, ';
echo  $diff->h . ' hours, ';
echo  $diff->i . ' minutes, ';
echo  $diff->s . ' seconds';
*/
$usage = $diff->days;
//echo 'The difference in days : ' . $diff->days;
if ($Lic_day >= $usage) {
    echo 'Your License is Valid <br>';
} else {
     header('location: ---.com');
                exit();
}
//echo "Today is:" .$end. "<br>";
echo "License set for:" .$start. "<br>";
echo "Date Limit:" .$Lic_day. "<br>";
echo "Used Day:" .$usage. "<br>";

?>

Re: Get HDD serial number and authentication scripts for rent License.

Hello Mirzasanower

You could try this

ShowMessage(GetHardDiskSerial('c'));

But this number will change if the installer reinstalls Windows.

Hope this can help you
JB

3 (edited by mirzasanower 2021-04-26 17:23:14)

Re: Get HDD serial number and authentication scripts for rent License.

Dear Mr. JB,

Thanks a lot for your answer.
Would you please tell me in more details.


Regards
Mirza

Re: Get HDD serial number and authentication scripts for rent License.

This small project maybe can help you

Post's attachments

Attachment icon GetHDDSerialNumber.rar 292.65 kb, 393 downloads since 2021-04-26 

Re: Get HDD serial number and authentication scripts for rent License.

Dear Mr. JB,

Many many thanks to you.

Regards
Mirza