Hey,
I cannot see exatly what im doing wrong here.. hopefully someone will be able to help out. I am trying to remove a specific ip address from a list box all all the data is stored in a flat text file "ips.txt" Example below.
Say this is the list.
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
5.5.5.5
IF i select to remove 4.4.4.4 i want it to be
removed from the text file.
if ($action == "remove") {
$file = "ips.txt";
$file2 = "ips2.txt";
copy("$file","$file2");
unlink("$file");
$finput=file("$file2");
$foutput=fopen("$file","a+");
$i=0;
while ($i < count($finput)):
if ($ips == $finput[$i]) {
fwrite($foutput,$finput[$i++]); $i++;
}
fwrite($foutput,$finput[$i]);
$i++;
endwhile;
fclose($foutput);
unlink("$file2");
}