Before you get too far into it, you may want to check out the "replacement" for that script here:
http://nms-cgi.sourceforge.net/. Matts scripts are know not to be too secure. I don't think he has updated them in severl years if I'm not mistaken.
~Charlie
[edit]
I may be mistaken. It looks like he added some security fixes last year. Maybe they are up to date?
[/edit]