Hi All,
Help me please...!
How to get harddisk serial number and motherboard serial number using php?.
Thank.

Member Avatar for diafol

you can't unless perhaps with gtk.

I would have severe problems with a web site accessing any part of my hardware

How to get harddisk serial number and motherboard serial number using php?.

On your server perhaps with an exec call to some linux function (if you set priviliges correctly). On the client, not possible.

Get Harddisk Serial number from localhost

<?php

function GetVolumeLabel($drive) {
  // Try to grab the volume name
  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 $serial;

?>

how to Get motherboard Serial number from localhost?

You'll need a tool to read and decipher the BIOS information.

where i can get the tool to read and decipher the BIOS information?.
thank you.

If the server is under linux you can use dmidecode for the motherboard serial:

sudo dmidecode --type 2 |grep -i serial

For the harddisk use hdparm:

sudo hdparm -I /dev/sda | grep -i serial

this will check for the serial of the master hd, for slaves you have to check for sdb, sdc... in any case, with both commands, you need to provide a password or you have to add the Apache user to the admin group which, for security reasons, it is never a great idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.