Here is my code:
$line = file("/opt/apps/$PROJECT");
foreach($line as $k => $v) {
if(strpos($v, $username)) {
unset($line[$k]);
}
}
$file = fopen("/opt/apps/$PROJECT","w+");
fwrite($file, implode("",$line));
fclose($file);
The file $PROJECT has the format of:
name:application
name2:application
and $username is selected from a form which corresponds to name, name2, etc.
I am trying to remove a username from the file with this code, but it won't work. No php errors either, just doesn't work and the app does have access to the file because the other form writes the name to the file.