Home  >  Article  >  Backend Development  >  Parse the csdn database password file and import it into mysql

Parse the csdn database password file and import it into mysql

WBOY
WBOYOriginal
2016-07-25 09:08:261002browse
Import csdn plaintext passwords into mysql database in batches
  1. set_time_limit(13600); //Set time
  2. $conn=mysql_connect('localhost','root',''); //Connect to database
  3. mysql_select_db('csdn',$conn) ;
  4. mysql_query("SET NAMES utf8");
  5. $file=file('csdn.txt');
  6. foreach($file as $line)
  7. {
  8. $u=explode('# ', $line);
  9. mysql_query("INSERT INTO `user` (username,password,email)VALUES('".trim($u[0])."','".trim($u[1])."','" .trim($u[2])."')",$conn);
  10. }
  11. echo 'OK';
  12. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn