Hallo Daniel
Ich habs jetzt doch geschafft ohne dieses module,
das wahrscheinlich nicht gefuntzt hätte bei mir jedenfalls. :)
Ok hier ist die Auflösung dess skriptes falls es Dich interessiert:
sub del {
$htpasswd = '/homepages/geschützt/.htpasswd';
$isdbfile = 0;
$ignorecrypts = 0;
$do = $posts{'do'}; $username=$ENV{'REMOTE_USER'};$password=$posts{'password'};
@htpasswdall = ($htpasswd);
$unameok = &OkUname("$username:$password");
$do = 'remove';
print "Content-type: text/html\n\n";
if ($do eq 'remove')
{
foreach $htpass (@htpasswdall)
{
if (&fileopen($htpass,''))
{
{
@newlines = ();
@lines = <FILE>;
&fileclose();
foreach $l (@lines)
{
chomp($l);
next if (!&OkUname($l));
push @newlines, $l if ($l !~ /^$username:/i);
}
$newfile = join("\n",@newlines);
&Dead('Cannot backup file!') if (!rename($htpass,$htpass . "glo"));
&fileopen($htpass,'>');
print FILE "$newfile\n";
system("chmod 666 $htpass");
}
&fileclose();
}
else
{&Dead('Cannot locate or open file for ');} } }
&Dead('your user and password has been deleted now contact the webmaster ');
sub Dead
{
#' print a header
print "</HTML><HEAD>
<META HTTP-EQUIV='REFRESH' CONTENT='5; URL=../abuse.htm'>
<TITLE>access denied</Title>
<script SRC='mouse.js' type='text/javascript'></script>
</HEAD>
<BODY BGCOLOR=#000000 TEXT=#FF0000 onLoad='abuse()'>\n";
print " " . (@_)[0] . "\n<BR>";
print " denied </CENTER><BR></BODY></HTML>\n";
SendMail();
}
#opening/closing
sub fileopen {
local($f,$mode) = @_;
$res= open(FILE,"$mode$f");
&lock();
return $res;
}
sub fileclose {
local($f) = @);
&unlock();
$res= close(FILE);
return $res;
}
#' locking/unlocking
sub lock {
local($mode)=@_;
flock(FILE,2);
seek(FILE, 0, 2) if (!$isdbfile && $mode eq '>>');
}
sub unlock {flock(FILE,8);}
sub OkUname {local($str) = @_; chomp $str; return (length($str) >= 4);
}
}
Besten dank und Grüsse vom Alain