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: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
From: "Cristian MARIN" <[EMAIL PROTECTED]>
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
[EMAIL PROTECTED]

  "Guru P Chaturvedi" <[EMAIL PROTECTED]> wrote in message =
news:[EMAIL PROTECTED]
  Hi Cristian,

  Well that's right... i wanna do it thru PHP Scrip... but dunno what =
exactly
  i should use... any clues...?


  "Cristian Marin" <[EMAIL PROTECTED]> wrote in message
  news:[EMAIL PROTECTED]
  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
  [EMAIL PROTECTED]

    "Guru P Chaturvedi" <[EMAIL PROTECTED]> wrote in message
  news:[EMAIL PROTECTED]
    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: [EMAIL PROTECTED]
    ---------------------------------------






------=_NextPart_000_005D_01C32C2A.B6E6E660--



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to