I’ve been using a combination of ntop, ulogd, ulog-acctd and specter for tracking ip traffic, with some success.
Some recently found this post, that mentions the same sort of things i want to do, along with some of the pitfalls I’ve hit with MySQL as a archive for logging. The post comments also mentions vnstat, which does exactly what my old script used to do, and also has a front-end in php. I also found another post about ipac-ng, which i’ve used in the past.