Updated the algorythm to detect and keep devices online:
  1. Insert new devices in the Database
  2. Update old devices that are in $devices - set their online_last to current time
  3. Delete devices that expired - their online_last is to old
Merge pull request #5 from stefan-chekanov/master

Updated the algorythm to detect and keep devices online: