将明文密码批量导入进mysql/ target=_blank class=infotextkey>mysql数据库的代码
<?php
set_time_limit(13600); //设置时间
$conn=mysql_connect('localhost','root',''); //连接数据库
mysql_select_db('csdn',$conn);
mysql_query("SET NAMES utf8");
$file=file('csdn.txt');
foreach($file as $line)
{
$u=explode('# ', $line);
mysql_query("INSERT INTO `user` (username,password,email)VALUES('".trim($u[0])."','".trim($u[1])."','".trim($u[2])."')",$conn);
}
echo 'OK';
?>