if (digitalRead(buttonPins[4]))[glow];[/glow]
This isn't doing anything...
exitflag = true;
} while (exitflag == false);
Doesn't look like exitFlag will ever get to be false.
digitalWrite(buttonPins[a], LOW);
Are the pins listed in buttonPins input or output? You are trying to use them as both.
You can't have it, with switches attached, both ways.