The problem is quite simple really. I'm trying to create a site, where the user can add a physical device to a database. Every device has its own unique id, which is stored in the database.
However, I want to make sure, that whoever types in the device id actually has access to the device, so that someone can't just type in a bunch of numbers and maybe get lucky.
To do this there is a button on the device, which makes a call to the webserver (HTTP).
I thought doing it like this:
- The user types in a device id
- The user gets redirected to a "waiting" site, which checks the database every x seconds for new entries, and checks if they're a match to the device id.
- When the button is pressed on the device, an entry gets made in the database which allows the user to continue from the "waiting" site.
The problem is, I don't know how to make the waiting site. As I see it, the way I have described step 2 above will create a lot of unnecessary calls to the database, so I was wondering how to do this effeciently?
Thanks in advance