Re: Deleting users from htpasswd
| From: | Max Graham | Date: | Fri, 06 Jun 2003 18:48:08 +0000 |
| Subject: | Re: Deleting users from htpasswd | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20236@lists.php.net to get a copy of this message | ||
If you want a script that's premade that'll do it for you, I suggest
PHPAccess ...
http://www.krizleebear.de/phpaccess/dynamisch/
If nothing else, it'll give you some code to look at to see how it's done in
case you don't want to use this and would rather customize your own
Message-ID: <20030606095358.80334.qmail@pb1.pair.com>
To: php-windows@lists.php.net
From: "Cristian MARIN" <cristic@interakt.ro>
Date: Fri, 6 Jun 2003 12:54:06 +0300
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_005D_01C32C2A.B6E6E660"
Subject: Re: Deleting users from htpasswd
------=_NextPart_000_005D_01C32C2A.B6E6E660
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
$user =3D "bubu";
$file_ht =3D fopen("path_to_the_htaccess","r+");
if ($file_ht){
$content_file =3D fread($file_ht, filesize("path_to_the_htaccess"));
fclose($file_ht);
$content_file =3D
preg_replace("/".$user.".*\n/","",$content_file);
$file_ht=3Dfopen("path_to_the_htaccess","w+");
if ($file_ht){
fwrite($file_ht,$content_file);
fclose($file_ht);
}else{
echo "Failed open for writing";
}
}else{
echo "failed open for reading";
}
You have to replace the user with the $user ( I don't know how do you =
take the user) and the path_to_the_htaccess
Hope it helps.
--=20
-------------------------------------------------
Cristian MARIN
InterAKT Online (www.interakt.ro)
+4021 411 2610=20
cristic@interakt.ro
"Guru P Chaturvedi" <bangboy2k2@hotmail.com> wrote in message =
news:20030606033838.79204.qmail@pb1.pair.com...
Hi Cristian,
Well that's right... i wanna do it thru PHP Scrip... but dunno what =
exactly
i should use... any clues...?
"Cristian Marin" <cristic@interakt.ro> wrote in message
news:20030604072033.29620.qmail@pb1.pair.com...
Remove the line of the user from the .htpasswd. You can do it manually =
or a
php script can do it for you.
--
-------------------------------------------------
Cristian MARIN
InterAKT Online (www.interakt.ro)
+4021 411 2610
cristic@interakt.ro
"Guru P Chaturvedi" <bangboy2k2@hotmail.com> wrote in message
news:20030604064012.94976.qmail@pb1.pair.com...
Hi,
i am storing all users for accessing apache resources in a file =
called
my.users i am able to add/modify users and passwords using the =
htpasswd
utility. But not able to remove a particular user... are there =
anyways of
doing it? can u please help...
with Warm Regards,
Guru.
---------------------------------------
Phone: (+91)9845290270
URL: www.gangarasa.com
Yahoo IM: guru4vedi
MSN: guru4vedi@gangarasa.com
---------------------------------------
------=_NextPart_000_005D_01C32C2A.B6E6E660--