-1

I'm developing a web application for one of my client. Their requirement is to collect the chit payment from their customers. So in single office there have multiple counters user can go and pay in any one counter. While crate payment entry need to pass the corresponding counter machine any of unique id to know the collection counter. This need to be show a report of every counter collection at the end of the day. We suggested to select the counter name on login but they are not accepting this because employees may mistakenly login with different counter. As well employees can site and work on any counter. So practically not possible to set counter to employee rights and mistaken will happen if they select counter on login. So need to give master to create system names / or nay unique id and need to pass the current system name / unique id on create payment entry. Please help any one to solve this problem and give best solution for this. We have currently developed this application using PHP , Codeigniter framework.

Vinoth Kumar
  • 489
  • 3
  • 17
  • 45
  • 4
    No, the browser can't do that – Jaromanda X Nov 03 '20 at 05:26
  • For that to work the `PHP` script needs to be running on client's local and send it to your server (cause your server can not directly access that) as mentioned in [another post](https://stackoverflow.com/a/39798078/8740349) like: ```function GetMAC(){ ob_start(); system('getmac'); $Content = ob_get_contents(); ob_clean(); return substr($Content, strpos($Content,'\\')-20, 17); }``` – Top-Master Nov 03 '20 at 05:37
  • 2
    Does this answer your question? [How to get MAC address of client using PHP?](https://stackoverflow.com/questions/5074139/how-to-get-mac-address-of-client-using-php) – Top-Master Nov 03 '20 at 05:38
  • Yes I tried function GetMAC(){ ob_start(); system('getmac'); $Content = ob_get_contents(); ob_clean(); return substr($Content, strpos($Content,'\\')-20, 17); } already but this worked on local machine only. I can not install php on every machine right. – Vinoth Kumar Nov 03 '20 at 05:41
  • 1
    If you can be sure that no user will be clearing the browser cache, just add a JS that query for a local storage key, and if it doesn't exist, store a GUID. Getting MAC of the client won't work because that will be a privacy nightmare, and running a random app directly on the client device simply from visiting a page will be security nightmare too – Martheen Nov 03 '20 at 05:42
  • I have read many response from users in tack over flow like IE active x controls, and most of them said this not possible. But is there any other solutions to achieve this except MAC id – Vinoth Kumar Nov 03 '20 at 05:43
  • 2
    @Top-Master: Lucky for us that PHP can't execute any script on client side so your code won't work – catcon Nov 03 '20 at 05:44
  • 1
    This sounds like an [XY-Problem](https://meta.stackexchange.com/q/66377/477156) and I suggest using [FingerPrint-JS](https://github.com/fingerprintjs/fingerprintjs) instead. – Top-Master Nov 03 '20 at 05:48
  • Fingerprinting likely won't work if the machines are part of a fleet and configured identically – Martheen Nov 03 '20 at 05:57
  • I second what Martheen said earlier- Use Javascript to get a value (ie, computer name) from local storage or cookie. If it has not been set or has been deleted, you would have to require user input (or maybe manager input) to save it locally before submission of form. You could even have this “key” displayed (if present) on the web page to have visual confirmation that the counter is ready for orders. It’s far from foolproof, but it’s about as unobtrusive as you’ll get without installing a client app on each counter. – Tim Morton Nov 03 '20 at 13:39

1 Answers1

0

Maybe you can try fingerprintjs to get a unique id.

https://github.com/fingerprintjs/fingerprintjs

banyudu
  • 1,046
  • 9
  • 19
  • 1
    While this will work well to fingerprint different users with wildly different machine, OP indicate the machines will be running in a single office. If they're all the same spec and have managed update, every single one of them will return identical fingerprint – Martheen Nov 03 '20 at 05:56
  • This fingerprint changing id for browser wise. If I run in different browser generating unique id – Vinoth Kumar Nov 03 '20 at 06:07
  • @VinothKumar Yes, that's the point. Fingerprinting relies on configuration differences, including browser. You can strip the browser part, but it will leave you with far smaller variation to work with. – Martheen Nov 03 '20 at 08:57
  • I have implemented this concept, this was working fine when we check our end, when move production and check in client environment same id showing in their 3 floors in 10 system same ID. I couldn't get any idea of this possibilities. Could you please help me on this, whether they have networked their system should show same IPS and machine name like that. – Vinoth Kumar Nov 06 '20 at 09:37
  • @Martheen could you please help me in this whether opensource fingerprint will return same id for individual browsers when ever I request a call – Vinoth Kumar Jan 28 '21 at 08:20
  • No, fingerprinting relies on variations of the configuration. That's why I suggest generating GUID on the local storage instead, that should solve your need for a unique identifier as long as users don't clear the browser's local storage cache. Any other solution such as fingerprinting and supercookies are being killed by browser makers – Martheen Jan 28 '21 at 09:04
  • @Martheen as of now I have set like localStorage.setItem('macid', 'F1-B1-E2-F0-0A-01'); static in that machine(individual machine mac id) locally and passing to server. This will be a temporary solution. When ever they clear browser history we need manually update local storage in this case. – Vinoth Kumar Jan 29 '21 at 04:21