PDA

View Full Version : For loop ban list


mainegate
04-07-2009, 06:16 PM
I have a ban list and on every line there is an ip address. I want to check to see if the ip address exists and if it DOES NOT then add the ip address. It keeps adding the same ip address to the file everytime. So I say if there is a match don't do anything but if there is not then add the ip. Any suggestions?

for (var index=0; index<this.myFileObj.length; index++) {
var currentIP = this.myFileObj[index];
if (clientObj.ip == currentIP) {

}
else
{
this.myFileObj.writeln(clientObj.ip);
this.myFileObj.close();
break;
}
}