<?php
/*
*作者:飞翔
*QQ:304569324
*/
require('config.php');
require('cls_mysql.php');
require('cls_json.php');
$json = new JSON();
$db = new mysql($db_host, $db_user, $db_pass, $db_name);
$file = file_get_contents("user.txt");
//取出一条
$file_r = explode(",",$file);
foreach((array)$file_r as $v)
{
if(empty($v))
{
$re = array("start"=>'2',"username"=>'');
die($json -> encode($re));
break;
}
$sql = "SELECT * FROM `pre_common_member` where username = '$v' LIMIT 1";
$res = $db -> getRow($sql);
if(!$res)
{
//存储
$file = @str_replace($v.",","",$file);
@file_put_contents("user.txt",$file);
$pass = substr($v,-6);
$mail = $pass.rand(1000,2000)."@126.com";
$re = array("start"=>'1',"username"=>$v,"pass"=>$pass,"email"=>$mail);
die($json -> encode($re));
break;
}
else
{
//存储
if($v == $file)
{
$file = str_replace($v,"",$file);
}
else
{
$file = str_replace($v.",","",$file);
}
@file_put_contents("user.txt",$file);
}
}
$re = array("start"=>'3',"username"=>'');
die($json -> encode($re));
?>
|