...
Code Block cd /var/www/html/
Code Block nano /var/www/html/getmac.php
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);
Note Copy from here and right click to paste in terminal
Save the file
Note Press keyboard: Ctrl + X >>>>> enter : Y >>>>>>>>>>> Press : Enter
Now chekc the MAC address for this computer first , and you can follow command
Code Block ip addr show
Example: after command will show this:: (Green colour line is MAC Address of this computer)
- Select the mac address (select and mark is copy in ubuntu function): 08:00:27:ef:a5:70
Now create another file called "StationMacAddress.txt" and method same point 2
Code Block nano /var/www/html/StationMacAddress.txt
Note a. 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
b. Right click the mouse for paste the MAc Address to StationMacAddress.txt
Save and exist :
Note Press keyboard: Ctrl + X >>>>> enter : Y >>>>>>>>>>> Press : Enter
- Open the file "StationMacAddress.txt" with cat function (This step is double check the MAX Address)
Change Apache access port and method like point 2
Code Block nano /etc/apache2/ports.conf
Note
command # to disable original port 22
next add Listen 8888 in next lineSave and exist :
Note Press keyboard: Ctrl + X >>>>> enter : Y >>>>>>>>>>> Press : Enter
Restart Apache service
Code Block service apache2 restart
- 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.
After completing the task on the computer, kindly provide the device's MAC address, purpose, associated properties, and the specific location within Eventum. This information will notify the development team for their next course of action.
- 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
Refenrence Note:
View file | ||||
---|---|---|---|---|
|