The pre-built login script available from my web site does something much like this.

You can create resource records with priority values, so if someone matches more than one resource record, the one with the highest priority will apply. You basically define multiple resource records with decreasing member lists and increasing priorities.

You might want to tinker with it instead of trying to create complex code logic.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D