My Password Check Loop Isn't Working

can someone help me out? i’m trying to check the passwords and names and i want it to goto the next frame if they match, security isn’t really an issue so i’m not going to go through php and mySQL and stuff

here’s the code:

on (release) {
	i = 0;
	for (i<=_root.numberofnames; true; i++) {
		if (_root.name.text == _root.namevar+i && _root.password.text == _root.passwordvar+i) {
			_root.nextFrame();
		} else {
			_root.denied._visible = true;
		}
	}
}

thanks