function new_user($username, $password, $email, $invitecode = null) { if ($invitecode) { $this->deactive_code($invitecode, $username); } $this->load->helper('comm'); $data = array('user_name' => $username, 'email' => $email, 'pass' => $password, 'passwd' => get_temp_pass(), 't' => '0', 'u' => '0', 'd' => '0', 'plan' => 'A', 'transfer_enable' => $this->get_default_transfer(), 'port' => $this->get_last_port() + rand(2, 7), 'switch' => '0', 'enable' => '0', 'type' => '7', 'invite_num' => $this->get_default_invite_number(), 'money' => '0'); $this->db->set('reg_date', 'NOW()', FALSE); return $this->db->insert('user', $data); }
echo " <script>window.location='reg.php';</script> "; } if (strlen($username) < 7 || strlen($username) > 32) { $info_ok = 0; echo ' <script>alert("用户名长度错误!")</script> '; echo " <script>window.location='reg.php';</script> "; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $info_ok = 0; echo ' <script>alert("邮箱地址错误")</script> '; echo " <script>window.location='reg.php';</script> "; } if ($info_ok) { //do reg //默认信息 $pass ss密码 $transfer 流量 $port 端口 $pass = get_temp_pass(); $transfer = $a_transfer; $r = new \Ss\User\Reg(); $last_port = $r->get_last_port(); $port = $last_port + rand(2, 7); //邀请码数量 $invite_num = rand($user_invite_min, $user_invite_max); $rt = reg($username, $email, $pwd, $pass, $transfer, $port, $invite_num, 0.0); if ($rt) { echo ' <script>alert("注册成功,返回登录!")</script> '; echo " <script>window.location='login.php';</script> "; //删除邀请码 if ($invite_only) { $ic->invite_code_del(); } } else {