in reply to Time of last login
Depends on the environment of all machines in question. That is: operating system, services, users, kind of service used for login, logfiles storing these actions, etc.
Depending on the answers the script may be a one-liner just firing a shell-command or 300 lines of code using various Modules and Packages for connecting different servers and services, parsing their response and validating the output.
--
trust in bash
but tie your camel