I'm sure there's a few ways to do it, but this way seems pretty good.
Write a script that takes the output from a "w"; cut (or awk) on the "idle" column; send a "kill -9" to the calling tty. However, some users may have jobs running in the backgroud that may need to see ouput from what they are running. There login appears to be idle, but they could have a few jobs in the background.