Re: Encrypting passwords in a flat file before import

From: Date: Wed, 09 Oct 2002 13:31:51 +0000
Subject: Re: Encrypting passwords in a flat file before import
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119425@lists.php.net to get a copy of this message
Off the top of my head I would use: $f = fopen("filename.csv","r"); $data = fread($f,filesize("filename.csv")); fclose($f); $split = explode("\n",$data); $counter = 0; foreach($split AS $row) { $myarray = explode(",",$row); $myarray[2] = md5($myarray[2]); $split[$counter] = implode(",",$myarray); $counter++; } $save = implode("\n",$split); $f = fopen("outfile.csv","w"); fwrite($f,$save); fclose($f); Don't quote me on that though since thats just off the top of my head. Adam Voigt adam.voigt@cryptocomm.com On Wed, 2002-10-09 at 08:39, Verdon Vaillancourt wrote: > Hi, > > I hope this question isn't too basic... > > I have a flat file (CSV) that I want to import into a mySQL db via > phpMyAdmin. The file has about 1200 rows and is in a format like: > > "value","value","password","value","value","etc" > The passwords are in clear text. I need them to be encrypted in md5. > > Is there any advice out there as to how I could process this flat-file > before I import into my db or after the fact? > > Thanks, verdon > Ps. Please cc me if replying to list as I am on digest mode > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#119425) next »