名称: | 执行SQL | |
函数名: | plug_query($sq) | |
说明: | 返回读取数据库返回数组 | |
返回说明: | 返回数据库对象 |
function plug_query($sq){
}
//读取软件列表返回对象 案例1
//根目录建立文件
require("./Plug/Plug.php")
$sql = "SELECT * FROM `bs_php_appinfo` ";
$db_array_value= plug_query($sql);
while ($value= mysqli_fetch_assoc($db_array_value))
{
print_r($value);
}
//批量注册添加用户时间 案例2
//固定头文件不用管
//2019.7.26
//引入单页文件
include ('Plug/Plug.php');
$configarray = include ('Data/configs/sys.config.php');
#http://127.0.0.1/Plug_ReUser.php?user=账号&sdate=状态0/1&daihao=软件代号&date=到期时间&pwd=密码&mail=邮箱&QQ=联系QQ&Mobile=手机&daili=代理1/2/3
#http://127.0.0.1/Plug_ReUser.php?user=qqq123&sdate=0&daihao=88888888&date=2020-12-12 00:00:00&pwd=123&mail=944463782@qq.com&QQ=944463782&Mobile=13683295544&daili=1
$user = plug_set_get('user');
$pwd = plug_set_get('pwd');
$sdate = plug_set_get('sdate');
$daihao = plug_set_get('daihao');
$date = plug_set_get('date'); //2019-12-12 11:00:00
$mail = plug_set_get('mail');
$QQ = plug_set_get('QQ');
$Mobile = plug_set_get('Mobile');
$daili = plug_set_get('daili'); //代理1-3
$DATE = date('Y-m-d H:i:s');
#查询账号是否存在
$sql = "SELECT * FROM `bs_php_user` WHERE `user_user` = '$user'";
$Arr = plug_query_array($sql);
if (!$Arr)
{
//密码生成
$pass = md5($configarray['pass_key'] . $pwd . $configarray['pass_key']);
//插入新纪录
$sql = "INSERT INTO`bs_php_user` (`user_uid`, `user_user`, `user_pwd`, `user_IsLock`, `user_email`, `user_mail_ok`, `user_qq`, `user_Mobile`, `user_mibao_wenti`, `user_mibao_daan`, `user_rmb`, `user_jifen`, `user_re_ip`, `user_re_date`, `user_Login_ip`, `user_Login_date`, `user_CaoShi`, `user_yao_User`, `user_yao_Shu`, `user_Zhe`, `user_LoGinNum`, `user_DenJi_tmp`, `user_DenJi`, `user_daili`)
VALUES (NULL,'$user','$pass','$sdate','$mail','0','$QQ','$Mobile','','','0.00','0','','$DATE',NULL,NULL,'0','','0','0.0','0','0','0','$daili');";
plug_query($sql);
$sql = "SELECT * FROM `bs_php_user` WHERE `user_user` LIKE '$user'LIMIT 0 , 30";
$Arr = plug_query_array($sql);
} else
{
// die('账号已经存在,CODE:1000');
}
//查询记录是否存在
$sql = "SELECT * FROM `bs_php_pattern_login` WHERE `L_User_uid` = '{$Arr['user_uid']}' and `L_daihao` = '$daihao' LIMIT 0 , 30";
$Arr2 = plug_query_array($sql);
if (!$Arr2)
{
//插入新纪录
$key = '';
$vip = strtotime($date);
$sql = "INSERT INTO`bs_php_pattern_login` (`L_id`, `L_User_uid`, `L_daihao`, `L_re_date`, `L_vip_date`, `L_IsLock`, `L_key_info`, `L_links_info`, `L_login_time`, `L_class`, `L_timing`, `L_vip_unix`, `L_ic_name`, `L_ic_pwd`, `L_ic_info`, `L_login_ip`, `L_re_ip`, `L_login_run`,`L_links_open`,`L_links`)
VALUES(NULL,'{$Arr['user_uid']}','$daihao','$DATE','0000-00-00','0',"$key",NULL,'$DATE','0','0','$vip',"$user",'','0','','','0','0','0');";
plug_query($sql);
die('执行成功,CODE:2000');
} else
{
die('已经存在app记录,CODE:3000');
}