本文整理匯總了PHP中sp_password函數的典型用法代碼示例。如果您正苦於以下問題:PHP sp_password函數的具體用法?PHP sp_password怎麽用?PHP sp_password使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了sp_password函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _before_write
protected function _before_write(&$data)
{
parent::_before_write($data);
if (!empty($data['user_pass']) && strlen($data['user_pass']) < 25) {
$data['user_pass'] = sp_password($data['user_pass']);
}
}
示例2: password_post
public function password_post()
{
if (IS_POST) {
if (empty($_POST['old_password'])) {
$this->error("原始密碼不能為空!");
}
if (empty($_POST['password'])) {
$this->error("新密碼不能為空!");
}
$uid = sp_get_current_userid();
$admin = $this->users_model->where("id={$uid}")->find();
$old_password = $_POST['old_password'];
$password = $_POST['password'];
if (sp_password($old_password) == $admin['user_pass']) {
if ($_POST['password'] == $_POST['repassword']) {
if ($admin['user_pass'] == sp_password($password)) {
$this->error("新密碼不能和原始密碼相同!");
} else {
$data['user_pass'] = sp_password($password);
$data['id'] = $uid;
$r = $this->users_model->save($data);
if ($r !== false) {
$this->success("修改成功!");
} else {
$this->error("修改失敗!");
}
}
} else {
$this->error("密碼輸入不一致!");
}
} else {
$this->error("原始密碼不正確!");
}
}
}
示例3: dologin
public function dologin()
{
$name = I("post.username");
if (empty($name)) {
$this->error(L('USERNAME_OR_EMAIL_EMPTY'));
}
$pass = I("post.password");
if (empty($pass)) {
$this->error(L('PASSWORD_REQUIRED'));
}
$verrify = I("post.verify");
if (empty($verrify)) {
$this->error(L('CAPTCHA_REQUIRED'));
}
//驗證碼
if (!sp_check_verify_code()) {
$this->error(L('CAPTCHA_NOT_RIGHT'));
} else {
$user = D("Common/Users");
if (strpos($name, "@") > 0) {
//郵箱登陸
$where['user_email'] = $name;
} else {
$where['user_login'] = $name;
}
$result = $user->where($where)->find();
if (!empty($result) && $result['user_type'] == 1) {
if ($result['user_pass'] == sp_password($pass)) {
$role_user_model = M("RoleUser");
$role_user_join = C('DB_PREFIX') . 'role as b on a.role_id =b.id';
$groups = $role_user_model->alias("a")->join($role_user_join)->where(array("user_id" => $result["id"], "status" => 1))->getField("role_id", true);
if ($result["id"] != 1 && (empty($groups) || empty($result['user_status']))) {
$this->error(L('USE_DISABLED'));
}
//登入成功頁麵跳轉
$_SESSION["ADMIN_ID"] = $result["id"];
$_SESSION['name'] = $result["user_login"];
$result['last_login_ip'] = get_client_ip();
$result['last_login_time'] = date("Y-m-d H:i:s");
$user->save($result);
setcookie("admin_username", $name, time() + 30 * 24 * 3600, "/");
$this->success(L('LOGIN_SUCCESS'), U("Index/index"));
} else {
$this->error(L('PASSWORD_NOT_RIGHT'));
}
} else {
$this->error(L('USERNAME_NOT_EXIST'));
}
}
}
示例4: doregister
function doregister()
{
$users_model = M("Users");
$rules = array(array('username', 'require', '賬號不能為空!', 1), array('mobile', 'require', '手機號不能為空!', 1), array('password', 'require', '密碼不能為空!', 1), array('repassword', 'require', '重複密碼不能為空!', 1), array('repassword', 'password', '確認密碼不正確', 0, 'confirm'));
if ($users_model->validate($rules)->create() === false) {
$this->error($users_model->getError());
}
extract($_POST);
//用戶名需過濾的字符的正則
$stripChar = '?<*.>\'"';
if (preg_match('/[' . $stripChar . ']/is', $username) == 1) {
$this->error('用戶名中包含' . $stripChar . '等非法字符!');
}
$banned_usernames = explode(",", sp_get_cmf_settings("banned_usernames"));
if (in_array($username, $banned_usernames)) {
$this->error("此用戶名禁止使用!");
}
if (strlen($password) < 5 || strlen($password) > 20) {
$this->error("密碼長度至少5位,最多20位!");
}
if (!preg_match("/^1\\d{10}\$/", $mobile)) {
$this->error('手機號碼格式不正確');
}
//需要獲取到的短信驗證碼驗證規則
$verifyCode = session("registerSMS");
if ($messcode != $verifyCode) {
$this->error("短信驗證碼不正確,請重新驗證!");
}
$where['user_login'] = $username;
$where['user_phone'] = $mobile;
$where['_logic'] = 'OR';
$users_model = M("Users");
$result = $users_model->where($where)->count();
if ($result) {
$this->error("用戶名或者該手機號已經存在!");
} else {
$data = array('user_login' => $username, 'user_phone' => $mobile, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(), 'create_time' => date("Y-m-d H:i:s"), 'last_login_time' => date("Y-m-d H:i:s"), "user_type" => 2);
$rst = $users_model->add($data);
if ($rst) {
//登入成功頁麵跳轉
$data['id'] = $rst;
$_SESSION['user'] = $data;
$this->success("注冊成功!", __ROOT__ . "/");
} else {
$this->error("注冊失敗!", U("user/register/index"));
}
}
}
示例5: dologin
public function dologin()
{
$name = I("post.username");
$this->err_msg = '';
if (empty($name)) {
$this->err_msg = L('USERNAME_OR_EMAIL_EMPTY');
}
$pass = I("post.password");
if (empty($pass)) {
$this->err_msg = L('PASSWORD_REQUIRED');
}
$verrify = I("post.verify");
if (empty($verrify)) {
$this->err_msg = L('CAPTCHA_REQUIRED');
}
//驗證碼
if (!$this->check_verify($verrify)) {
$this->err_msg = L('CAPTCHA_NOT_RIGHT');
}
if (!empty($this->err_msg)) {
$this->assign("err_msg", $this->err_msg);
$this->display(":login");
exit;
}
$user = D("AdminUser");
$where['user_login'] = $name;
$result = $user->where($where)->find();
if ($result != null) {
if ($result['user_pass'] == sp_password($pass)) {
//登入成功頁麵跳轉
$_SESSION["ADMIN_ID"] = $result["id"];
$_SESSION['name'] = $result["user_login"];
session("roleid", $result['role_id']);
$result['last_login_ip'] = get_client_ip();
$result['last_login_time'] = date("Y-m-d H:i:s");
$user->save($result);
setcookie("admin_username", $name, time() + 30 * 24 * 3600, "/");
$this->redirect("Index/index");
} else {
$this->err_msg = L('PASSWORD_NOT_RIGHT');
}
} else {
$this->err_msg = L('USERNAME_NOT_EXIST');
}
$this->assign("err_msg", $this->err_msg);
$this->display(":login");
}
示例6: change_pwd
function change_pwd($oldpwd, $newpwd)
{
//驗證舊密碼
$prefix = C("DB_PREFIX");
$uid = $_SESSION['user']['id'];
$sql = "select user_pass from {$prefix}member where uid = {$uid}";
$res = $this->find($uid);
$oldpwd = sp_password($oldpwd);
if ($res['user_pass'] != $oldpwd) {
return -1;
//舊密碼錯誤
}
$data['user_pass'] = sp_password($newpwd);
$where['id'] = $uid;
$result = $this->where($where)->save($data);
return $result;
}
示例7: dologin
public function dologin()
{
$name = I("post.username");
if (empty($name)) {
$this->error(L('USERNAME_OR_EMAIL_EMPTY'));
}
$pass = I("post.password");
if (empty($pass)) {
$this->error(L('PASSWORD_REQUIRED'));
}
$verrify = I("post.verify");
if (empty($verrify)) {
$this->error(L('CAPTCHA_REQUIRED'));
}
//驗證碼
if ($_SESSION['_verify_']['verify'] != strtolower($verrify)) {
$this->error(L('CAPTCHA_NOT_RIGHT'));
} else {
$user = D("Users");
if (strpos($name, "@") > 0) {
//郵箱登陸
$where['user_email'] = $name;
} else {
$where['user_login'] = $name;
}
$result = $user->where($where)->find();
if ($result != null && $result['user_type'] == 1) {
if ($result['user_pass'] == sp_password($pass)) {
//登入成功頁麵跳轉
$_SESSION["ADMIN_ID"] = $result["id"];
$_SESSION['name'] = $result["user_login"];
session("roleid", $result['role_id']);
$result['last_login_ip'] = get_client_ip();
$result['last_login_time'] = date("Y-m-d H:i:s");
$user->save($result);
setcookie("admin_username", $name, time() + 30 * 24 * 3600, "/");
$this->success(L('LOGIN_SUCCESS'), U("Index/index"));
} else {
$this->error(L('PASSWORD_NOT_RIGHT'));
}
} else {
$this->error(L('USERNAME_NOT_EXIST'));
}
}
}
示例8: dologin
public function dologin()
{
$name = I("post.username");
if (empty($name)) {
$this->error("用戶名或郵箱不能為空!");
}
$pass = I("post.password");
if (empty($pass)) {
$this->error("密碼不能為空!");
}
$verrify = I("post.verify");
if (empty($verrify)) {
$this->error("驗證碼不能為空!");
}
//驗證碼
if ($_SESSION['_verify_']['verify'] != strtolower($verrify)) {
$this->error("驗證碼錯誤!");
} else {
$user = D("Users");
if (strpos($name, "@") > 0) {
//郵箱登陸
$where['user_email'] = $name;
} else {
$where['user_login'] = $name;
}
$result = $user->where($where)->find();
if ($result != null) {
if ($result['user_pass'] == sp_password($pass)) {
//登入成功頁麵跳轉
$_SESSION["ADMIN_ID"] = $result["ID"];
$_SESSION['name'] = $result["user_login"];
session("roleid", $result['role_id']);
$result['last_login_ip'] = get_client_ip();
$result['last_login_time'] = date("Y-m-d H:i:s");
$user->save($result);
setcookie("admin_username", $name, time() + 30 * 24 * 3600, "/");
$this->success("登錄驗證成功!", U("Index/index"));
} else {
$this->error("密碼錯誤!");
}
} else {
$this->error("用戶名不存在!");
}
}
}
示例9: password_post
function password_post()
{
if (IS_POST) {
if (empty($_POST['old_password'])) {
$this->error("原始密碼不能為空!");
}
if (empty($_POST['password'])) {
$this->error("新密碼不能為空!");
}
$user_obj = D("Users");
$uid = get_current_admin_id();
$admin = $user_obj->where(array("id" => $uid))->find();
$old_password = $_POST['old_password'];
$password = $_POST['password'];
if (sp_password($old_password) == $admin['user_pass']) {
if ($_POST['password'] == $_POST['repassword']) {
if ($admin['user_pass'] == sp_password($password)) {
$this->error("新密碼不能和原始密碼相同!");
} else {
$data['user_pass'] = sp_password($password);
$data['id'] = $uid;
$r = $user_obj->save($data);
if ($r !== false) {
$this->success("修改成功!");
} else {
$this->error("修改失敗!");
}
}
} else {
$this->error("密碼輸入不一致!");
}
} else {
$this->error("原始密碼不正確!");
}
}
}
示例10: str_replace
$strConfig = str_replace('#DB_USER#', $dbUser, $strConfig);
$strConfig = str_replace('#DB_PWD#', $dbPwd, $strConfig);
$strConfig = str_replace('#DB_PORT#', $dbPort, $strConfig);
$strConfig = str_replace('#DB_PREFIX#', $dbPrefix, $strConfig);
$strConfig = str_replace('#AUTHCODE#', sp_random_string(18), $strConfig);
$strConfig = str_replace('#COOKIE_PREFIX#', sp_random_string(6) . "_", $strConfig);
@chmod(SITEDIR . '/data/conf/db.php', 0777);
@file_put_contents(SITEDIR . '/data/conf/db.php', $strConfig);
//插入管理員
//生成隨機認證碼
$verify = sp_random_string(6);
$time = time();
$create_date = date("Y-m-d h:i:s");
$ip = get_client_ip();
$ip = empty($ip) ? "0.0.0.0" : $ip;
$password = sp_password($password, $dbPrefix);
$query = "INSERT INTO `{$dbPrefix}users` (id,user_login,user_pass,user_nicename,user_email,user_url,create_time,user_activation_key,user_status,last_login_ip,last_login_time) VALUES ('1', '{$username}', '{$password}', 'admin', '{$email}', '', '{$create_date}', '', '1', '{$ip}','{$create_date}');";
mysql_query($query);
$message = '成功添加管理員<br />成功寫入配置文件<br>安裝完成.';
$arr = array('n' => 999999, 'msg' => $message);
echo json_encode($arr);
exit;
}
include_once "./templates/s4.php";
exit;
case '5':
$ip = get_client_ip();
$host = $_SERVER['HTTP_HOST'];
include_once "./templates/s5.php";
@touch('./install.lock');
exit;
示例11: _do_email_login
private function _do_email_login()
{
$username = $_POST['username'];
$password = $_POST['password'];
if (strpos($username, "@") > 0) {
//郵箱登陸
$where['user_email'] = $username;
} else {
$where['user_login'] = $username;
}
$users_model = M('Users');
$result = $users_model->where($where)->find();
$ucenter_syn = C("UCENTER_ENABLED");
$ucenter_old_user_login = false;
$ucenter_login_ok = false;
if ($ucenter_syn) {
setcookie("thinkcmf_auth", "");
include UC_CLIENT_ROOT . "client.php";
list($uc_uid, $username, $password, $email) = uc_user_login($username, $password);
if ($uc_uid > 0) {
if (!$result) {
$data = array('user_login' => $username, 'user_email' => $email, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(0, true), 'create_time' => time(), 'last_login_time' => time(), 'user_status' => '1', 'user_type' => 2);
$id = $users_model->add($data);
$data['id'] = $id;
$result = $data;
}
} else {
switch ($uc_uid) {
case "-1":
//用戶不存在,或者被刪除
if ($result) {
//本應用已經有這個用戶
if (sp_compare_password($password, $result['user_pass'])) {
//本應用已經有這個用戶,且密碼正確,同步用戶
$uc_uid2 = uc_user_register($username, $password, $result['user_email']);
if ($uc_uid2 < 0) {
$uc_register_errors = array("-1" => "用戶名不合法", "-2" => "包含不允許注冊的詞語", "-3" => "用戶名已經存在", "-4" => "Email格式有誤", "-5" => "Email不允許注冊", "-6" => "該Email已經被注冊");
$this->error("同步用戶失敗--" . $uc_register_errors[$uc_uid2]);
}
$uc_uid = $uc_uid2;
} else {
$this->error("密碼錯誤1!");
}
}
break;
case -2:
//密碼錯
if ($result) {
//本應用已經有這個用戶
if (sp_compare_password($password, $result['user_pass'])) {
//本應用已經有這個用戶,且密碼正確,同步用戶
$uc_user_edit_status = uc_user_edit($username, "", $password, "", 1);
if ($uc_user_edit_status <= 0) {
$this->error("登陸錯誤3!");
}
list($uc_uid2) = uc_get_user($username);
$uc_uid = $uc_uid2;
$ucenter_old_user_login = true;
} else {
$this->error("密碼錯誤4!");
}
} else {
$this->error("密碼錯誤1!");
}
break;
}
}
$ucenter_login_ok = true;
echo uc_user_synlogin($uc_uid);
}
//exit();
if (!empty($result)) {
if (sp_compare_password($password, $result['user_pass']) || $ucenter_login_ok) {
$_SESSION["user"] = $result;
//寫入此次登錄信息
$data = array('last_login_time' => date("Y-m-d H:i:s"), 'last_login_ip' => get_client_ip(0, true));
$users_model->where("id=" . $result["id"])->save($data);
$redirect = empty($_SESSION['login_http_referer']) ? __ROOT__ . "/" : $_SESSION['login_http_referer'];
$_SESSION['login_http_referer'] = "";
$ucenter_old_user_login_msg = "";
if ($ucenter_old_user_login) {
//$ucenter_old_user_login_msg="老用戶請在跳轉後,再次登陸";
}
$this->success("登錄驗證成功!", $redirect);
} else {
$this->error("密碼錯誤7!");
}
} else {
$this->error("用戶名不存在!");
}
}
示例12: changepass
function changepass()
{
if (IS_POST) {
if ($_POST['pass'] != $_POST['repass']) {
$this->error("兩次密碼輸入不一致!");
}
if (strlen($_POST['pass']) < 5 || strlen($_POST['pass']) > 12) {
$this->error("密碼長度至少5位,最多12位!");
}
$mem = M('Members');
$uid = $_SESSION["MEMBER_id"];
$user_info = $mem->where("ID={$uid}")->find();
$old_password = $_POST['inipass'];
$password = $_POST['pass'];
if (sp_password($old_password) == $user_info['user_pass']) {
if ($user_info['user_pass'] == sp_password($password)) {
$this->error("新密碼不能和原密碼相同!");
} else {
$ucenter_syn = C("UCENTER_ENABLED");
$can_change_password = true;
if ($ucenter_syn) {
include UC_CLIENT_ROOT . "client.php";
$uc_result = uc_user_edit($user_info['user_login_name'], $old_password, $password, "");
if (!$uc_result) {
$can_change_password = false;
}
}
if ($can_change_password) {
$data['user_pass'] = sp_password($password);
$data['ID'] = $uid;
$r = $mem->save($data);
if ($r != false) {
$this->success("修改成功!");
} else {
$this->error("修改失敗!");
}
} else {
$this->error("修改失敗!");
}
}
} else {
$this->error("原密碼不正確!");
}
} else {
$this->error('提交數據為空!');
}
}
示例13: dologin
function dologin()
{
if ($_SESSION['_verify_']['verify'] != strtolower($_POST['verify'])) {
$this->error("驗證碼錯誤!");
}
$users_model = M("Users");
$rules = array(array('terms', 'require', '您未同意服務條款!', 1), array('username', 'require', '用戶名或者郵箱不能為空!', 1), array('password', 'require', '密碼不能為空!', 1));
if ($users_model->validate($rules)->create() === false) {
$this->error($users_model->getError());
}
extract($_POST);
if (strpos($username, "@") > 0) {
//郵箱登陸
$where['user_email'] = $username;
} else {
$where['user_login'] = $username;
}
$users_model = M('Users');
$result = $users_model->where($where)->find();
$ucenter_syn = C("UCENTER_ENABLED");
$ucenter_old_user_login = false;
$ucenter_login_ok = false;
if ($ucenter_syn) {
setcookie("xiaocaocms_auth", "");
include UC_CLIENT_ROOT . "client.php";
list($uc_uid, $username, $password, $email) = uc_user_login($username, $password);
if ($uc_uid > 0) {
if (!$result) {
$data = array('user_login' => $username, 'user_email' => $email, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(), 'create_time' => time(), 'last_login_time' => time(), 'user_status' => '1');
$id = $users_model->add($data);
$data['id'] = $id;
$result = $data;
}
} else {
switch ($uc_uid) {
case "-1":
//用戶不存在,或者被刪除
if ($result) {
//本應用已經有這個用戶
if ($result['user_pass'] == sp_password($password)) {
//本應用已經有這個用戶,且密碼正確,同步用戶
$uc_uid2 = uc_user_register($username, $password, $result['user_email']);
if ($uc_uid2 < 0) {
$uc_register_errors = array("-1" => "用戶名不合法", "-2" => "包含不允許注冊的詞語", "-3" => "用戶名已經存在", "-4" => "Email格式有誤", "-5" => "Email不允許注冊", "-6" => "該Email已經被注冊");
$this->error("同步用戶失敗--" . $uc_register_errors[$uc_uid2]);
}
$uc_uid = $uc_uid2;
} else {
$this->error("密碼錯誤!");
}
}
break;
case -2:
//密碼錯
if ($result) {
//本應用已經有這個用戶
if ($result['user_pass'] == sp_password($password)) {
//本應用已經有這個用戶,且密碼正確,同步用戶
$uc_user_edit_status = uc_user_edit($username, "", $password, "", 1);
if ($uc_user_edit_status <= 0) {
$this->error("登陸錯誤!");
}
list($uc_uid2) = uc_get_user($username);
$uc_uid = $uc_uid2;
$ucenter_old_user_login = true;
} else {
$this->error("密碼錯誤!");
}
} else {
$this->error("密碼錯誤!");
}
break;
}
}
$ucenter_login_ok = true;
echo uc_user_synlogin($uc_uid);
}
//exit();
if ($result != null) {
if ($result['user_pass'] == sp_password($password) || $ucenter_login_ok) {
$_SESSION["user"] = $result;
//寫入此次登錄信息
$data = array('last_login_time' => date("Y-m-d H:i:s"), 'last_login_ip' => get_client_ip());
$users_model->where("id=" . $result["id"])->save($data);
$redirect = empty($_SESSION['login_http_referer']) ? __ROOT__ . "/" : $_SESSION['login_http_referer'];
$_SESSION['login_http_referer'] = "";
$ucenter_old_user_login_msg = "";
if ($ucenter_old_user_login) {
//$ucenter_old_user_login_msg="老用戶請在跳轉後,再次登陸";
}
$this->success("登錄驗證成功!", $redirect);
} else {
$this->error("密碼錯誤!");
}
} else {
$this->error("用戶名不存在!");
}
}
示例14: do_password_set_password
public function do_password_set_password()
{
$users_model = M("Member");
$rules = array(array('password', 'require', '密碼不能為空!', 1), array('repassword', 'require', '重複密碼不能為空!', 1), array('repassword', 'password', '確認密碼不正確', 0, 'confirm'));
if (strlen(I('post.password')) < 6 || strlen(I('post.password')) > 20) {
$this->error("密碼長度至少6位,最多20位!");
}
if ($users_model->validate($rules)->create() === false) {
$this->error($users_model->getError());
} else {
$password = sp_password(I("post.password"));
$result = $users_model->where(array("user_login" => $_SESSION['find_password_user']['user_login']))->save(array("user_pass" => $password));
if ($result) {
$_SESSION['find_password_user'];
$this->success("設置成功,請登錄!", U("user/login/index"));
} else {
$this->error("設置失敗!");
}
}
}
示例15: _do_email_register
private function _do_email_register()
{
if (!sp_check_verify_code()) {
$this->error("驗證碼錯誤!");
}
$rules = array(array('user_type', 'require', '請選擇用戶類型!', 1), array('email', 'require', '郵箱不能為空!', 1), array('password', 'require', '密碼不能為空!', 1), array('repassword', 'require', '重複密碼不能為空!', 1), array('repassword', 'password', '確認密碼不正確', 0, 'confirm'), array('email', 'email', '郵箱格式不正確!', 1));
$users_model = M("Users");
if ($users_model->validate($rules)->create() === false) {
$this->error($users_model->getError());
}
$password = $_POST['password'];
$email = $_POST['email'];
$user_type = $_POST['user_type'];
$username = str_replace(array(".", "@"), "_", $email);
//用戶名需過濾的字符的正則
$stripChar = '?<*.>\'"';
if (preg_match('/[' . $stripChar . ']/is', $username) == 1) {
$this->error('用戶名中包含' . $stripChar . '等非法字符!');
}
// $banned_usernames=explode(",", sp_get_cmf_settings("banned_usernames"));
// if(in_array($username, $banned_usernames)){
// $this->error("此用戶名禁止使用!");
// }
if (strlen($password) < 5 || strlen($password) > 20) {
$this->error("密碼長度至少5位,最多20位!");
}
if ($user_type > 3 || $user_type < 1) {
$this->error("非法操作!");
}
$where['user_login'] = $username;
$where['user_email'] = $email;
$where['_logic'] = 'OR';
$ucenter_syn = C("UCENTER_ENABLED");
$uc_checkemail = 1;
$uc_checkusername = 1;
if ($ucenter_syn) {
include UC_CLIENT_ROOT . "client.php";
$uc_checkemail = uc_user_checkemail($email);
$uc_checkusername = uc_user_checkname($username);
}
$users_model = M("Users");
$result = $users_model->where($where)->count();
if ($result || $uc_checkemail < 0 || $uc_checkusername < 0) {
$this->error("用戶名或者該郵箱已經存在!");
} else {
$uc_register = true;
if ($ucenter_syn) {
$uc_uid = uc_user_register($username, $password, $email);
//exit($uc_uid);
if ($uc_uid < 0) {
$uc_register = false;
}
}
if ($uc_register) {
$need_email_active = C("SP_MEMBER_EMAIL_ACTIVE");
$data = array('user_login' => $username, 'user_email' => $email, 'user_nicename' => $username, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(0, true), 'create_time' => date("Y-m-d H:i:s"), 'last_login_time' => date("Y-m-d H:i:s"), 'user_status' => $need_email_active ? 2 : 1, "user_type" => $user_type);
$rst = $users_model->add($data);
if ($rst) {
//登入成功頁麵跳轉
$data['id'] = $rst;
$_SESSION['user'] = $data;
//發送激活郵件
if ($need_email_active) {
$this->_send_to_active();
unset($_SESSION['user']);
$this->success("注冊成功,激活後才能使用!", U("user/login/index"));
} else {
$this->success("注冊成功!", __ROOT__ . "/");
}
} else {
$this->error("注冊失敗!", U("user/register/index"));
}
} else {
$this->error("注冊失敗!", U("user/register/index"));
}
}
}