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
Release: 2016-07-25 08:52:03
Original
1120 people have browsed it
  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. ?>

复制代码


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template