Hello,
I tried that but it isn't deleting the file. Here are some more specifics:
I want to enter a username in a form and assign the value to $username. Then I want to delete that username from .htpasswd.
What do I need to do differently?
#!/usr/bin/php
<?
$file = "/home/public_html/custom/php/.htpasswd";
$text = file($file);
$user_to_remove = "$username";
while (list ($key, $value) = each($text))
{
if($value != $user_to_remove)
{
$new_list .= $value;
}
}
$fp = fopen($file, "w");
fwrite($fp, $new_list);
echo "success!";
?>
Thanks,
Tim