Re: 'htaccess" method : how to modify passwords from PHP scripts ?

From: Date: Thu, 26 Jul 2001 07:49:56 +0000
Subject: Re: 'htaccess" method : how to modify passwords from PHP scripts ?
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-10789@lists.php.net to get a copy of this message
Hi, Thank you to everybody who answered my question. Unfortunately, I don't use classes in my php. Here is the solution I actually used : ---------------------------------------------- ---------------------------------------------- // Generate new line for username + modified password $line = read_cgi("username").":".crypt(read_cgi("password"))."\n"; // opens a temp file $pass_file_tmp = fopen(PASS_FILE_TMP,"a"); // reads actual password file $fcontents = file(PASS_FILE); while ( list( $numero_ligne, $ligne ) = each( $fcontents ) ) { if (!ereg(read_cgi("username"),$ligne)) { fwrite($pass_file_tmp,$ligne); } } // add new password of the selected user fwrite($pass_file_tmp,$line); // deletes the old passwd file and replaced by the new one rename(PASS_FILE_TMP,PASS_FILE); ---------------------------------------------- ---------------------------------------------- Regards, -- Samuel Torton NCSLab.com

« previous php.db (#10789) next »