function locoyspider_user_register($email = NULL, $utype = '1') { global $db, $locoyspider, $QS_pwdhash; $setsqlarr['username'] = $locoyspider['reg_usname'] . uniqid() . time(); $setsqlarr['pwd_hash'] = res_randstr(); //reg_password if ($locoyspider['reg_password_tpye'] == "1") { $pwd = $setsqlarr['username']; } elseif ($locoyspider['reg_password_tpye'] == "3") { $pwd = $locoyspider['reg_password']; } else { $pwd = res_randstr(7); //长度为7的随机字符串 } //email if (empty($email) || !preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $email)) { $email = time() . uniqid() . $locoyspider['reg_email']; } $setsqlarr['password'] = md5(md5($pwd) . $setsqlarr['pwd_hash'] . $QS_pwdhash); $setsqlarr['email'] = $email; $setsqlarr['utype'] = $utype; $setsqlarr['reg_time'] = time(); $setsqlarr['robot'] = 1; //标记为采集 $reg_id = $db->inserttable(table('members'), $setsqlarr, true); if (!$reg_id) { return false; } if ($utype == '1') { if (!$db->query("INSERT INTO " . table('members_points') . " (uid) VALUES ('{$reg_id}')")) { return false; } if (!$db->query("INSERT INTO " . table('members_setmeal') . " (uid) VALUES ('{$reg_id}')")) { return false; } } return $reg_id; }
function locoyspider_user_register($email = NULL, $utype = '1') { global $db, $locoyspider, $QS_pwdhash, $_CFG; $setsqlarr['username'] = $locoyspider['reg_usname'] . uniqid() . time(); $setsqlarr['pwd_hash'] = res_randstr(); //reg_password if ($locoyspider['reg_password_tpye'] == "1") { $pwd = $setsqlarr['username']; } elseif ($locoyspider['reg_password_tpye'] == "3") { $pwd = $locoyspider['reg_password']; } else { $pwd = res_randstr(7); //长度为7的随机字符串 } //email if (empty($email) || !preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $email)) { $email = time() . uniqid() . $locoyspider['reg_email']; } $setsqlarr['password'] = md5(md5($pwd) . $setsqlarr['pwd_hash'] . $QS_pwdhash); $setsqlarr['email'] = $email; $setsqlarr['utype'] = $utype; $setsqlarr['reg_time'] = time(); $setsqlarr['robot'] = 1; //标记为采集 $reg_id = $db->inserttable(table('members'), $setsqlarr, true); if (!$reg_id) { return false; } if ($utype == '1') { if (!$db->query("INSERT INTO " . table('members_points') . " (uid) VALUES ('{$reg_id}')")) { return false; } if (!$db->query("INSERT INTO " . table('members_setmeal') . " (uid) VALUES ('{$reg_id}')")) { return false; } $points = get_cache('points_rule'); include_once QISHI_ROOT_PATH . 'include/fun_company.php'; set_consultant($reg_id); if ($points['reg_points']['value'] > 0) { report_deal($reg_id, $points['reg_points']['type'], $points['reg_points']['value']); $operator = $points['reg_points']['type'] == "1" ? "+" : "-"; write_memberslog($reg_id, 1, 9001, $username, "新注册会员,({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, 1010, "注册会员系统自动赠送积分", "{$operator}{$points['reg_points']['value']}", "{$points['reg_points']['value']}"); //积分变更记录 write_setmeallog($reg_id, $username, "注册会员系统自动赠送:({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, '0.00', '1', 1, 1); } if ($_CFG['reg_service'] > 0) { set_members_setmeal($reg_id, $_CFG['reg_service']); $setmeal = get_setmeal_one($_CFG['reg_service']); write_memberslog($reg_id, 1, 9002, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 2, 1011, "开通服务(系统赠送)", "-", "-"); //套餐变更记录 write_setmeallog($reg_id, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 1, '0.00', '1', 2, 1); } } return $reg_id; }