Home >Backend Development >PHP Tutorial >Code for batch importing plain text passwords into mysql database

Code for batch importing plain text passwords into mysql database

WBOY
WBOYOriginal
2016-07-25 08:52:031105browse
  1. set_time_limit(13600); //设置时间

  2. $conn=mysql_connect('localhost','root',''); //连接数据库
  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. ?>

复制代码


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