MIN registration number based on POS Station's MAC address
What is MAC Address? → MAC address - Wikipedia
How to find out your PC Mac address (Windows 10/11) → https://www.howtogeek.com/761481/how-to-find-your-mac-address-on-windows-10-or-11/
Advised MAC Address format in TEXT file: AA:BB:CC:DD:EE:FF
The MIN Registration number and permit number will be fetched by Ehors based on POS Stations' MAC Addresses.
And the MAC address is from the computer's network interface hardware ID. This means if you have the network interface changed/repaired, you'll get a new MAC address for the computer.
Due to web browsers aren't allowed to read the MAC address from the computer directly, we need an interface in between to read the MAC address and send it back to the WINX system.
E-HORS Archived WAMP software → https://www.ehors.com/downloads/laragon-wamp.exe
Kindly advise NOT to use RANDOM MAC Address:
Requirement:
- Computer with Windows Operating System
- Can install WAMP (Windows Apache Management Protocol)
Install lightweight PHP service on the computer to handle MAC Address reading
- Download "Laragon" from this LINK or our fixed archived HERE
- Execute the installer downloaded, first option ONLY chose "Run Laragon when Windows Starts", rest uncheck.
- Once installation is complete, it should start Larafon in your "Taskbar"
- Double-click to open the interface, if the service started, chose "Stop", we'll need to do some quick configuration to Laragon
- One-Stop, select the gear icon on the top right of the windows to configure the Laragon
- In "General" you should have the setting as follow, except for the "Document Root" and "Data Directory", rest should follow as highlighted
- Under Service & Ports, make sure have following service also. Important is the Apache port with "8888"
- Mail Catcher and Mail Sender shall disable as we do not need such service as follow:
- Once configured, just save by closing this "Preferences" window with the "x" icon on the top right.
Then you shall "Start All" - If all is correct, you should have this in the Laragon window.
Once you have the file open, copy the following code into the "getmac.php"
<?php header('Access-Control-Allow-Origin: *'); $Result = array("STATUS" => "", "MAC_ADDR" => ""); function ReadMacAddressWinCommand() { global $Result; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $GetMacResult = exec('getmac /fo csv /nh | findstr /V /R /C:"disconnected"') or die("UNABLE_EXEC_GETMAC_CMD"); if ($GetMacResult != "") { // First see if can explode out \n and or \r\n $ConnectionResults = explode("\n", $GetMacResult); // ONLY USe first connection; $ActiveConnectionFirst = $ConnectionResults[0]; // Get Only MAC Address; $ConnectionInfo = explode(",", $ActiveConnectionFirst); // MAC ADDRESS TAKE OUT " $ActiveMacAddress = str_replace('"', '', $ConnectionInfo[0]); // if ($ActiveMacAddress != "") { $Result["STATUS"] = "OK"; $Result["MAC_ADDR"] = $ActiveMacAddress; } } else { $Result["STATUS"] = "CANNOT_GET_MAC_ADDRESS"; } } else { $Result["STATUS"] = "NOTN_WIN_SYSTEM"; } } if (isset($_REQUEST["CMD"]) && $_REQUEST["CMD"] == "GETMAC") { // First test read a fixed txt file $FixMacAddressFile = "./StationMacAddress.txt"; $MacAddressFile = fopen($FixMacAddressFile, "r"); if ($MacAddressFile) { $MacAddressFixed = rtrim(fread($MacAddressFile, filesize($FixMacAddressFile))); fclose($MacAddressFile); if (preg_match('/^(?:(?:[0-9a-f]{2}[\:]{1}){5}|(?:[0-9a-f]{2}[-]{1}){5}|(?:[0-9a-f]{2}){5})[0-9a-f]{2}$/i', $MacAddressFixed) == 1) { $Result["STATUS"] = "OK"; $Result["MAC_ADDR"] = $MacAddressFixed; } else { ReadMacAddressWinCommand(); } } else { ReadMacAddressWinCommand(); } } echo json_encode($Result);
- Save the file
- Now create another file called "StationMacAddress.txt", using the method in point 13
- Click away to save the file name
- Open the file "StationMacAddress.txt" with notepad.exe as point 16
- Put in your mac address of the POS station as registered in MIN into the file (Example), make sure no "new line" after the mac address
- Save this text file.
- Save it and that all, you can "test" it by calling from browser: localhost:8888/getmac.php?CMD=GETMAC and should have the following screen.
- For IT personnel test and checking, if the MAC address is correctly fetch by WINX system, you can find the "MACADDRESS" variable from browser debugger:
Double-check the following programs before using the POS terminals. You should see MIN & PTU details and the MAC Address