MIN registration number based on POS Station's MAC address
What is MAC Address? → MAC address - Wikipedia
...
E-HORS Archived WAMP software → https://www.ehors.com/downloads/laragon-wamp.exe
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"
Code Block language php linenumbers true <?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.
...