当前位置: 首页>>代码示例>>PHP>>正文


PHP save_user函数代码示例

本文整理汇总了PHP中save_user函数的典型用法代码示例。如果您正苦于以下问题:PHP save_user函数的具体用法?PHP save_user怎么用?PHP save_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了save_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $usr = new User();
     $usr->username = "admin";
     $usr->password = "admin";
     $usr->role = "admin";
     save_user($usr);
 }
开发者ID:quyen91,项目名称:lfpr,代码行数:8,代码来源:create_admin_user_task.php

示例2: save

 public function save()
 {
     require_once APP_ROOT_PATH . 'system/libs/user.php';
     foreach ($_REQUEST as $k => $v) {
         $_REQUEST[$k] = htmlspecialchars(addslashes(trim($v)));
     }
     if ($GLOBALS['user_info']['user_name']) {
         $_REQUEST['user_name'] = $GLOBALS['user_info']['user_name'];
     }
     $res = save_user($_REQUEST, 'UPDATE');
     if ($res['status'] == 1) {
         // user_name mobile province_id city_id byear bmonth bday sex my_intro id
         // 向im.lingang.me发送用户名片修改请求
         $phone = $_REQUEST['mobile'];
         $rid = es_cookie::get("rid");
         $sig = md5($phone . "_" . $rid . "_" . $rid);
         $url = get_doubi_host();
         $post = array('action' => 'edit_profile', 'sig' => $sig, 'phone' => $phone, 'uname' => $_REQUEST['user_name'], 'uintro' => $_REQUEST['my_intro'], 'gender' => $_REQUEST['sex'], 'birth' => $_REQUEST['byear'] . "-" . $_REQUEST['bmonth'] . "-" . $_REQUEST['bday']);
         $response = json_decode(sentSigPost($url, $post), true);
         $s_user_info = es_session::get("user_info");
         $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = '" . intval($s_user_info['id']) . "'");
         es_session::set("user_info", $user_info);
         if (intval($_REQUEST['is_ajax']) == 1) {
             echo 1;
         } else {
             showSuccess($GLOBALS['lang']['SAVE_USER_SUCCESS']);
         }
     } else {
         $error = $res['data'];
         if (!$error['field_show_name']) {
             $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
         }
         if ($error['error'] == EMPTY_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == FORMAT_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == EXIST_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
         }
         if (intval($_REQUEST['is_ajax']) == 1) {
             echo 1;
         } else {
             showErr($error_msg);
         }
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:48,代码来源:uc_accountModule.class.php

示例3: do_register

 public function do_register()
 {
     //查询用户是否存在
     $aqj_id = trim($_POST['reg_aqjid']);
     $aqj_mobile = trim($_POST['reg_m']);
     $xlc_user = $GLOBALS['db']->getRow("select id,mobile,user_pwd from " . DB_PREFIX . "user where mobile='" . $aqj_mobile . "'");
     if ($xlc_user) {
         $aqj_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ap_partner_user where user_id=" . $xlc_user['id']);
         if (!$aqj_user) {
             $user_ap_partner = array();
             $user_ap_partner['user_id'] = $xlc_user['id'];
             $user_ap_partner['partner_id'] = 2;
             $user_ap_partner['partner_user_id'] = $aqj_id;
             $user_ap_partner['create_time'] = time();
             $GLOBALS['db']->autoExecute(DB_PREFIX . "ap_partner_user", $user_ap_partner);
         } else {
             $GLOBALS['db']->query("update " . DB_PREFIX . "ap_partner_user set partner_user_id = '" . $aqj_id . "' where user_id = " . $xlc_user['id']);
         }
         require_once APP_ROOT_PATH . "system/libs/user.php";
         auto_do_login_user($xlc_user['mobile'], $xlc_user['user_pwd']);
         app_redirect(url("aps"));
     } else {
         require_once APP_ROOT_PATH . "system/libs/user.php";
         $user_data = array();
         $user_data['user_name'] = $aqj_mobile;
         $user_data['mobile'] = $aqj_mobile;
         $user_data['user_pwd'] = rand(100000, 999999);
         //开启邮箱验证
         if (app_conf("USER_VERIFY") == 0 || app_conf("USER_VERIFY") == 2) {
             $user_data['is_effect'] = 1;
         } else {
             $user_data['is_effect'] = 0;
         }
         $res = save_user($user_data);
         statistics('register');
         $user_ap_partner = array();
         $user_ap_partner['user_id'] = $res['data'];
         $user_ap_partner['partner_id'] = 2;
         $user_ap_partner['partner_user_id'] = $aqj_id;
         $user_ap_partner['create_time'] = time();
         $GLOBALS['db']->autoExecute(DB_PREFIX . "ap_partner_user", $user_ap_partner);
         $result = do_login_user($user_data['mobile'], $user_data['user_pwd']);
         send_auto_register_pwd($aqj_mobile, $user_data['user_pwd']);
         app_redirect(url("aps"));
     }
 }
开发者ID:xinlechou,项目名称:app,代码行数:46,代码来源:aqjloginModule.class.php

示例4: registration

 public function registration()
 {
     if (isset($_POST['registred'])) {
         $log = $_POST['login'];
         $pass = $_POST['password'];
         $email = $_POST['email'];
         $name = $_POST['name'];
         include_once "/../config.php";
         include_once "/../models/model_user.php";
         if (!save_user($log, $pass, $email, $name)) {
             header('Location: ' . $_SESSION['base_url'] . '/login');
         }
         $_SESSION['login'] = $log;
         $user_id = get_user($log);
         $user_id = $user_id['id'];
         $_SESSION['user_id'] = $user_id;
         $_SESSION["autorised"] = true;
         header('Location: ' . $_SESSION['base_url'] . '/home');
     }
     header('Location: ' . $_SESSION['base_url'] . '/login');
 }
开发者ID:sasha2567,项目名称:rabota,代码行数:21,代码来源:registration.php

示例5: save_pwd

 public function save_pwd()
 {
     $GLOBALS['manageagency_info'] = $this->checkLogin();
     require_once APP_ROOT_PATH . 'system/libs/manageagency.php';
     foreach ($_REQUEST as $k => $v) {
         $_REQUEST[$k] = htmlspecialchars(addslashes(trim($v)));
     }
     if ($_REQUEST['sta'] == 1) {
         $sms_code = trim($_REQUEST['sms_code']);
         $phone = $GLOBALS['manageagency_info']['mobile'];
         $code = $GLOBALS['db']->getOne("SELECT verify_code FROM " . DB_PREFIX . "mobile_verify_code where mobile='" . $phone . "'");
         if ($sms_code != $code) {
             showErr("验证码输出错误!", intval($_REQUEST['is_ajax']));
         }
     }
     if (intval($_REQUEST['id']) == 0) {
         $_REQUEST['id'] = intval($GLOBALS['manageagency_info']['id']);
     }
     $res = save_user($_REQUEST, 'UPDATE');
     if ($res['status'] == 1) {
         $s_user_info = es_session::get("manageagency_info");
         $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_agency where id = '" . intval($s_user_info['id']) . "'");
         es_session::set("user_info", $user_info);
         if (intval($_REQUEST['is_ajax']) == 1) {
             showSuccess($GLOBALS['lang']['SUCCESS_TITLE'], 1);
         } else {
             app_redirect(url("index", "manageagency#index"));
         }
     } else {
         $error = $res['data'];
         if (!$error['field_show_name']) {
             $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
         }
         if ($error['error'] == EMPTY_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == FORMAT_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == EXIST_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
         }
         showErr($error_msg, intval($_REQUEST['is_ajax']));
     }
 }
开发者ID:workplayteam,项目名称:P2P,代码行数:45,代码来源:manageagencyModule.class.php

示例6: update

 public function update()
 {
     $data = M('User')->create();
     $log_info = M('User')->where("id=" . intval($data['id']))->getField("user_name");
     //开始验证有效性
     //        $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     $this->assign("jumpUrl", u(MODULE_NAME . "/index"));
     if (!check_empty($data['user_pwd']) && $data['user_pwd'] != $_REQUEST['user_confirm_pwd']) {
         $this->error(L("USER_PWD_CONFIRM_ERROR"));
     }
     $res = save_user($_REQUEST, 'UPDATE');
     if ($res['status'] == 0) {
         $error_field = $res['data'];
         if ($error_field['error'] == EMPTY_ERROR) {
             if ($error_field['field_name'] == 'user_name') {
                 $this->error(L("USER_NAME_EMPTY_TIP"));
             } elseif ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_EMPTY_TIP"));
             } else {
                 $this->error(sprintf(L("USER_EMPTY_ERROR"), $error_field['field_show_name']));
             }
         }
         if ($error_field['error'] == FORMAT_ERROR) {
             if ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_FORMAT_TIP"));
             }
             if ($error_field['field_name'] == 'mobile') {
                 $this->error(L("USER_MOBILE_FORMAT_TIP"));
             }
         }
         if ($error_field['error'] == EXIST_ERROR) {
             if ($error_field['field_name'] == 'user_name') {
                 $this->error(L("USER_NAME_EXIST_TIP"));
             }
             if ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_EXIST_TIP"));
             }
         }
     }
     //开始更新is_effect状态
     M("User")->where("id=" . intval($_REQUEST['id']))->setField("is_effect", intval($_REQUEST['is_effect']));
     save_log($log_info . L("UPDATE_SUCCESS"), 1);
     $this->success(L("UPDATE_SUCCESS"));
 }
开发者ID:macall,项目名称:baikec_jsd,代码行数:44,代码来源:JsdManagerAction.class.php

示例7: getvalescaped

 */
include "../../include/db.php";
include "../../include/general.php";
include "../../include/authenticate.php";
$url = $baseurl_short . "pages/team/team_user_edit.php?ref=" . getvalescaped("ref", "", true);
if (!checkperm("u")) {
    redirect($baseurl_short . "login.php?error=error-permissions-login&url=" . urlencode($url));
}
$ref = getvalescaped("ref", "", true);
$backurl = getval("backurl", "");
if (getval("unlock", "") != "") {
    # reset user lock
    sql_query("update user set login_tries='0' where ref='{$ref}'");
} elseif (getval("save", "") != "" || getval("suggest", "") != "") {
    # Save user data
    $result = save_user($ref);
    if ($result === false) {
        $error = $lang["useralreadyexists"];
    } elseif ($result !== true) {
        $error = $result;
    } else {
        hook('aftersaveuser');
        if (getval("save", "") != "") {
            $backurl = getval("backurl", $baseurl_short . "pages/team/team_user.php?nc=" . time());
            redirect($backurl);
        }
    }
}
# Fetch user data
$user = get_user($ref);
if ($user["usergroup"] == 3 && $usergroup != 3) {
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:team_user_edit.php

示例8: save_user

        ?>
" name="save"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            <?php 
    } else {
        if (isset($_POST['save'])) {
            $id = $_POST['user_id'];
            $firstname = $_POST['firstname'];
            $lastname = $_POST['lastname'];
            $department = $_POST['department'];
            $email = $_POST['email'];
            save_user($id, $firstname, $lastname, $email, $department);
        }
    }
}
foreach ($users as $user) {
    $email = get_user_email_by_id($user['ID']);
    $department = get_department_name(get_user_department($user['ID']));
    ?>
                <form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post" class="users">
                    <table>
                        <tbdoy>
                            <tr>
                                <td><?php 
开发者ID:google-code-backups,项目名称:threesixtieweb,代码行数:31,代码来源:users.php

示例9: index

 public function index()
 {
     //		$email = strim($GLOBALS['request']['email']);//邮箱
     $email = strim($GLOBALS['request']['mobile']);
     //邮箱
     $mobile = $email;
     $pwd = strim($GLOBALS['request']['password']);
     //密码
     $user_name = $email;
     //邮箱
     $code = strim($GLOBALS['request']['code']);
     //		$user_name = strim($GLOBALS['request']['user_name']);//用户名
     //		$gender = intval($GLOBALS['request']['gender']);
     $ref_uid = intval($GLOBALS['request']['ref_uid']);
     //		$city_name =strim($GLOBALS['request']['city_name']);//城市名称
     if ($mobile == '') {
         $root['status'] = 0;
         $root['info'] = '手机号码不能为空';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['status'] = 0;
         $root['info'] = "请输入正确的手机号码";
         output($root);
     }
     //print_r($GLOBALS['request']);
     if ($code == '') {
         $root['info'] = "请输入验证码!";
         $root['status'] = 0;
         output($root);
     }
     $db_code = $GLOBALS['db']->getRow("select id,code,add_time from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '{$mobile}' order by id desc");
     //print_r($db_code['code']);
     if ($db_code['code'] != $code) {
         $root['info'] = "请输入正确的验证码!";
         $root['status'] = 0;
         output($root);
     }
     $new_time = get_gmtime();
     if ($new_time - $db_code['add_time'] > 60 * 30) {
         $root['info'] = "验证码已失效,请重新获取!";
         $root['status'] = 0;
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify  where mobile_phone = " . $mobile . "");
         output($root);
     }
     //$GLOBALS['db']->query("update ".DB_PREFIX."sms_mobile_verify set status = 1 where id=".$db_code['id']."");
     $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where id=" . $db_code['id'] . "");
     if (strlen($pwd) < 4) {
         $root['return'] = 0;
         $root['info'] = "密码不能低于四位";
     } else {
         $user_data['email'] = $email;
         $user_data['user_name'] = $user_name;
         $user_data['mobile'] = $mobile;
         $user_data['user_pwd'] = $pwd;
         $user_data['sex'] = '-1';
         if ($ref_uid) {
             $user_data['pid'] = $ref_uid;
         } else {
             $user_data['pid'] = 0;
         }
         $res = save_user($user_data);
         if ($res['status'] == 1) {
             $root['return'] = 1;
             $root['status'] = 1;
             // fwb add 2014-08-27
             $root['info'] = "注册成功";
             $root['uid'] = $res['data'];
             $root['id'] = $res['data'];
             $root['user_name'] = $user_name;
             $root['user_email'] = $email;
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($root['uid'], "big"));
             $root['user_pwd'] = $res['user_pwd'];
         } else {
             $error = $res['data'];
             if (!$error['field_show_name']) {
                 $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
             }
             if ($error['error'] == EMPTY_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == FORMAT_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == EXIST_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
             }
             $root['return'] = 0;
             $root['status'] = 0;
             // fwb add 2014-08-27
             $root['info'] = $error_msg;
         }
     }
     if (strim($GLOBALS['request']['sina_id']) != '') {
         $root['login_type'] = "Sina";
     }
     if (strim($GLOBALS['request']['tencent_id']) != '') {
         $root['login_type'] = "Tencent";
     }
     if (strim($GLOBALS['request']['qq_id']) != '') {
//.........这里部分代码省略.........
开发者ID:macall,项目名称:baikec_jsd,代码行数:101,代码来源:register.action.php

示例10: do_api_register

 public function do_api_register()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $api_info = es_session::get("api_user_info");
     if (!$api_info) {
         app_redirect_preview();
     }
     $user_name = strim($_REQUEST['user_name']);
     $email = strim($_REQUEST['email']);
     $user_data['user_name'] = $user_name;
     $user_data['email'] = $email;
     $user_data['user_pwd'] = rand(100000, 999999);
     $user_data['province'] = $api_info['province'];
     $user_data['city'] = $api_info['city'];
     $user_data['is_effect'] = 1;
     $user_data['sex'] = $api_info['sex'];
     $res = save_user($user_data);
     if ($res['status'] == 1) {
         if (!check_ipop_limit(get_client_ip(), "user_do_api_register", 5)) {
             showErr("提交太快", 1);
         }
         $user_id = intval($res['data']);
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $api_info['field'] . " = '" . $api_info['name'] . "'," . $api_info['token_field'] . " = '" . $api_info['token'] . "'," . $api_info['secret_field'] . " = '" . $api_info['secret'] . "'," . $api_info['url_field'] . " = '" . $api_info['url'] . "' where id = " . $user_id);
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_weibo where user_id = " . $user_id . " and weibo_url = '" . $api_info['url'] . "'");
         update_user_weibo($user_id, $api_info['url']);
         $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
         if ($user_info['is_effect'] == 1) {
             //在此自动登录
             do_login_user($user_data['email'], $user_data['user_pwd']);
             ajax_return(array("status" => 1, "jump" => get_gopreview()));
         } else {
             ajax_return(array("status" => 0, "info" => "请等待管理员审核", "jump" => get_gopreview()));
         }
     } else {
         $error = $res['data'];
         if ($error['field_name'] == "user_name") {
             $data[] = array("type" => "form_success", "field" => "email", "info" => "");
             $field_name = "会员帐号";
         }
         if ($error['field_name'] == "email") {
             $data[] = array("type" => "form_success", "field" => "user_name", "info" => "");
             $field_name = "电子邮箱";
         }
         if ($error['error'] == EMPTY_ERROR) {
             $error_info = "不能为空";
             $type = "form_tip";
         }
         if ($error['error'] == FORMAT_ERROR) {
             $error_info = "格式有误";
             $type = "form_error";
         }
         if ($error['error'] == EXIST_ERROR) {
             $error_info = "已存在";
             $type = "form_error";
         }
         ajax_return(array("status" => 0, "info" => $field_name . $error_info, "field" => $error['field_name'], "jump" => get_gopreview()));
     }
 }
开发者ID:xcdxcd,项目名称:zhongchou,代码行数:58,代码来源:userModule.class.php

示例11: email_update_password

 public function email_update_password()
 {
     $ajax = intval($_REQUEST['ajax']);
     $email = strim($_REQUEST['email']);
     $user_pwd = strim($_REQUEST['user_pwd']);
     $confirm_user_pwd = strim($_POST['confirm_user_pwd']);
     $settings_mobile_code1 = strim($_POST['verify_coder']);
     if (!$email) {
         showErr("邮件为空", $ajax);
     }
     if ($user_pwd == "") {
         showErr("密码为空", $ajax);
     }
     if ($user_pwd !== $confirm_user_pwd) {
         showErr("两次密码不一致", $ajax);
     }
     if ($settings_mobile_code1 == "") {
         showErr("邮件验证码为空", $ajax);
     }
     //判断验证码是否正确=============================
     if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "mobile_verify_code WHERE email='" . $email . "' AND verify_code='" . $settings_mobile_code1 . "'") == 0) {
         showErr("邮件验证码错误", $ajax);
     }
     if ($user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where email ='{$email}'")) {
         $user_info['user_pwd'] = $user_pwd;
         $res = save_user($user_info, "UPDATE");
         showSuccess("密码修改成功", $ajax, url("user#login"));
     } else {
         showErr("没有该邮箱账户", $ajax);
     }
 }
开发者ID:xinlechou,项目名称:app,代码行数:31,代码来源:userModule.class.php

示例12: index

 public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //邮箱
     $pwd = strim($GLOBALS['request']['password']);
     //密码
     $user_name = strim($GLOBALS['request']['user_name']);
     //用户名
     $gender = intval($GLOBALS['request']['gender']);
     $ref_uid = intval($GLOBALS['request']['ref_uid']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     if (strlen($pwd) < 4) {
         $root['return'] = 0;
         $root['info'] = "密码不能低于四位";
     } else {
         $user_data['email'] = $email;
         $user_data['user_name'] = $user_name;
         $user_data['user_pwd'] = $pwd;
         $user_data['sex'] = $gender;
         if ($ref_uid) {
             $user_data['pid'] = $ref_uid;
         } else {
             $user_data['pid'] = 0;
         }
         $res = save_user($user_data);
         if ($res['status'] == 1) {
             $root['return'] = 1;
             $root['status'] = 1;
             // fwb add 2014-08-27
             $root['info'] = "注册成功";
             $root['uid'] = $res['data'];
             $root['id'] = $res['data'];
             $root['user_name'] = $user_name;
             $root['user_email'] = $email;
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($root['uid'], "big"));
             $root['user_pwd'] = $res['user_pwd'];
         } else {
             $error = $res['data'];
             if (!$error['field_show_name']) {
                 $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
             }
             if ($error['error'] == EMPTY_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == FORMAT_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == EXIST_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
             }
             $root['return'] = 0;
             $root['status'] = 0;
             // fwb add 2014-08-27
             $root['info'] = $error_msg;
         }
     }
     if (strim($GLOBALS['request']['sina_id']) != '') {
         $root['login_type'] = "Sina";
     }
     if (strim($GLOBALS['request']['tencent_id']) != '') {
         $root['login_type'] = "Tencent";
     }
     if (strim($GLOBALS['request']['qq_id']) != '') {
         $root['login_type'] = "Qq";
     }
     $root['page_title'] = '注册';
     $root['city_name'] = $city_name;
     output($root);
 }
开发者ID:macall,项目名称:jsd,代码行数:70,代码来源:register.action.php

示例13: wx_do_register

 public function wx_do_register()
 {
     $user_info = array();
     $user_info['mobile'] = strim($_REQUEST['mobile']);
     $user_info['verify_coder_email'] = strim($_REQUEST['verify_coder_email']);
     $user_info['verify_coder'] = strim($_REQUEST['verify_coder']);
     $user_info['wx_openid'] = strim($_REQUEST['wx_openid']);
     $user_info['user_name'] = strim($_REQUEST['user_name']);
     $user_info['province'] = strim($_REQUEST['province']);
     $user_info['email'] = strim($_REQUEST['email']);
     $user_info['city'] = strim($_REQUEST['city']);
     $user_info['sex'] = strim($_REQUEST['sex']);
     if (app_conf('USER_VERIFY') == 2 || app_conf('USER_VERIFY') == 4) {
         if (!$user_info['mobile']) {
             $data['status'] = 0;
             $data['info'] = "手机号码为空";
             ajax_return($data);
         }
         if ($user_info['verify_coder'] == "") {
             $data['status'] = 0;
             $data['info'] = "手机验证码为空";
             ajax_return($data);
         }
         //判断验证码是否正确=============================
         if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "mobile_verify_code WHERE mobile=" . $user_info['mobile'] . " AND verify_code='" . $user_info['verify_coder'] . "'") == 0) {
             $data['status'] = 0;
             $data['info'] = "手机验证码错误";
             ajax_return($data);
         }
         $user = get_user_has('mobile', $user_info['mobile']);
     }
     require_once APP_ROOT_PATH . "system/libs/user.php";
     if ($user) {
         if ($user_info['wx_openid']) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set wx_openid='" . $user_info['wx_openid'] . "' where id=" . $user['id']);
         }
         $user_id = $user['id'];
     } else {
         if (app_conf("USER_VERIFY") != 2) {
             if (!$user_info['email']) {
                 $data['status'] = 0;
                 $data['info'] = "邮箱为空";
                 ajax_return($data);
             }
             if (!check_email($user_info['email'])) {
                 $data['status'] = 0;
                 $data['info'] = "邮箱格式错误";
                 ajax_return($data);
             }
             if (app_conf('USER_VERIFY') == 1 || app_conf('USER_VERIFY') == 4) {
                 if ($user_info['verify_coder_email'] == "") {
                     $data['status'] = 0;
                     $data['info'] = "邮件验证码为空";
                     ajax_return($data);
                 }
             }
             $user = get_user_has('email', $user_info['email']);
         }
         if ($user) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set wx_openid='" . $user_info['wx_openid'] . "' where id=" . $user['id']);
             $user_id = $user['id'];
         } else {
             $has_user_name = get_user_has('user_name', $user_info['user_name']);
             if ($has_user_name) {
                 $user_info['user_name'] = $user_info['user_name'] . rand(10000, 99999);
             }
             if ($user_info['sex'] == 0) {
                 $user_info['sex'] = -1;
             } elseif ($user_info['sex'] == 1) {
                 $user_info['sex'] = 1;
             } else {
                 $user_info['sex'] = 0;
             }
             //开启邮箱验证
             if (app_conf("USER_VERIFY") != 3) {
                 $user_info['is_effect'] = 1;
             } else {
                 $user_info['is_effect'] = 0;
             }
             $user_info['create_time'] = get_gmtime();
             $user_info['update_time'] = get_gmtime();
             //新建用户 使用验证码作为密码
             $user_info['user_pwd'] = $user_info['verify_coder'];
             //$GLOBALS['db']->autoExecute(DB_PREFIX."user",$user_info,"INSERT");
             $res = save_user($user_info);
             if ($res['status'] == 0) {
                 $data['status'] = 0;
                 $data['info'] = $res['data']['field_name'] . '错误';
                 ajax_return($data);
             }
             $user_id = intval($res['data']);
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set user_name='" . strim($_REQUEST['user_name']) . "_" . $user_id . "' where id=" . $user_id);
         }
     }
     $user_info_new = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
     if ($user_info_new['is_effect'] == 1) {
         if ($user_info_new['mobile']) {
             $name = $user_info_new['mobile'];
         } elseif ($user_info_new['email']) {
             $name = $user_info_new['email'];
//.........这里部分代码省略.........
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:101,代码来源:user.action.php

示例14: parseBulkFile

function parseBulkFile($text, $filename)
{
    global $Conf;
    $text = cleannl($text);
    if (!is_valid_utf8($text)) {
        $text = windows_1252_to_utf8($text);
    }
    $filename = $filename ? "{$filename}:" : "line ";
    $success = array();
    if (!preg_match('/\\A[^\\r\\n]*(?:,|\\A)(?:user|email)(?:[,\\r\\n]|\\z)/', $text) && !preg_match('/\\A[^\\r\\n]*,[^\\r\\n]*,/', $text)) {
        $tarr = CsvParser::split_lines($text);
        foreach ($tarr as &$t) {
            if (($t = trim($t)) && $t[0] !== "#" && $t[0] !== "%") {
                $t = CsvGenerator::quote($t);
            }
            $t .= "\n";
        }
        unset($t);
        $text = join("", $tarr);
    }
    $csv = new CsvParser($text);
    $csv->set_comment_chars("#%");
    $line = $csv->next();
    if ($line && (array_search("email", $line) !== false || array_search("user", $line) !== false)) {
        $csv->set_header($line);
    } else {
        $csv->set_header(array("user"));
        $csv->unshift($line);
    }
    $cj_template = (object) array();
    $topic_revmap = array();
    foreach ($Conf->topic_map() as $id => $name) {
        $topic_revmap[strtolower($name)] = $id;
    }
    $unknown_topics = array();
    $errors = array();
    while (($line = $csv->next()) !== false) {
        $cj = clone $cj_template;
        foreach ($line as $k => $v) {
            $cj->{$k} = $v;
        }
        foreach (array("firstname" => "firstName", "first" => "firstName", "lastname" => "lastName", "last" => "lastName", "fullname" => "name", "fullName" => "name", "voice" => "voicePhoneNumber", "phone" => "voicePhoneNumber", "address1" => "addressLine1", "province" => "state", "region" => "state", "address2" => "addressLine2", "postalcode" => "zipCode", "zip" => "zipCode", "tags" => "contactTags") as $k => $x) {
            if (isset($cj->{$k}) && !isset($cj->{$x})) {
                $cj->{$x} = $cj->{$k};
            }
        }
        // thou shalt not set passwords by bulk update
        unset($cj->password, $cj->password_plaintext, $cj->new_password);
        if (isset($cj->name) && !isset($cj->firstName) && !isset($cj->lastName)) {
            list($cj->firstName, $cj->lastName) = Text::split_name($cj->name);
        }
        if (count($topic_revmap)) {
            foreach (array_keys($line) as $k) {
                if (preg_match('/^topic:\\s*(.*?)\\s*$/i', $k, $m)) {
                    if (($ti = @$topic_revmap[strtolower($m[1])]) !== null) {
                        $x = $line[$k];
                        if (strtolower($x) === "low") {
                            $x = -2;
                        } else {
                            if (strtolower($x) === "high") {
                                $x = 4;
                            } else {
                                if (!is_numeric($x)) {
                                    $x = 0;
                                }
                            }
                        }
                        if (!@$cj->topics) {
                            $cj->topics = (object) array();
                        }
                        $cj->topics->{$ti} = $x;
                    } else {
                        $unknown_topics[$m[1]] = true;
                    }
                }
            }
        }
        $cj->id = "new";
        $ustatus = new UserStatus(array("send_email" => true, "no_deprivilege_self" => true));
        if ($saved_user = save_user($cj, $ustatus, null, true)) {
            $success[] = "<a href=\"" . hoturl("profile", "u=" . urlencode($saved_user->email)) . "\">" . Text::user_html_nolink($saved_user) . "</a>";
        }
        foreach ($ustatus->error_messages() as $e) {
            $errors[] = "<span class='lineno'>" . $filename . $csv->lineno() . ":</span> " . $e;
        }
    }
    if (count($unknown_topics)) {
        $errors[] = "There were unrecognized topics (" . htmlspecialchars(commajoin($unknown_topics)) . ").";
    }
    if (count($success) == 1) {
        $successMsg = "Saved account " . $success[0] . ".";
    } else {
        if (count($success)) {
            $successMsg = "Saved " . plural($success, "account") . ": " . commajoin($success) . ".";
        }
    }
    if (count($errors)) {
        $errorMsg = "<div class='parseerr'><p>" . join("</p>\n<p>", $errors) . "</p></div>";
    }
    if (count($success) && count($errors)) {
//.........这里部分代码省略.........
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:101,代码来源:profile.php

示例15: doregister

 public function doregister()
 {
     //注册验证码
     if (intval(app_conf("VERIFY_IMAGE")) == 1 && intval(app_conf("USER_VERIFY")) >= 3) {
         $verify = md5(trim($_REQUEST['verify']));
         $session_verify = es_session::get('verify');
         if ($verify != $session_verify) {
             showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], 0, url("shop", "user#register"));
         }
     }
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $user_data = $_POST;
     if (!$user_data) {
         app_redirect("404.html");
         exit;
     }
     foreach ($user_data as $k => $v) {
         $user_data[$k] = htmlspecialchars(addslashes($v));
     }
     if (trim($user_data['user_pwd']) != trim($user_data['user_pwd_confirm'])) {
         showErr($GLOBALS['lang']['USER_PWD_CONFIRM_ERROR']);
     }
     if (trim($user_data['user_pwd']) == '') {
         showErr($GLOBALS['lang']['USER_PWD_ERROR']);
     }
     if (isset($user_data['referer']) && $user_data['referer'] != "") {
         $p_user_data = $GLOBALS['db']->getRow("SELECT id,user_type FROM " . DB_PREFIX . "user WHERE mobile ='" . $user_data['referer'] . "' OR user_name='" . $user_data['referer'] . "'");
         if ($p_user_data["user_type"] == 3) {
             $user_data['referer_memo'] = $p_user_data['id'];
             //$user_data['pid'] = $p_user_data['id'];
             $user_data['pid'] = 0;
         } elseif ($p_user_data["user_type"] < 2) {
             $user_data['pid'] = $p_user_data["id"];
             if ($user_data['pid'] > 0) {
                 $refer_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user WHERE pid='" . $user_data['pid'] . "' ");
                 if ($refer_count == 0) {
                     $user_data['referral_rate'] = (double) trim(app_conf("INVITE_REFERRALS_MIN"));
                 } elseif ((double) trim(app_conf("INVITE_REFERRALS_MIN")) + $refer_count * (double) trim(app_conf("INVITE_REFERRALS_RATE")) > (double) trim(app_conf("INVITE_REFERRALS_MAX"))) {
                     $user_data['referral_rate'] = (double) trim(app_conf("INVITE_REFERRALS_MAX"));
                 } else {
                     $user_data['referral_rate'] = (double) trim(app_conf("INVITE_REFERRALS_MIN")) + $refer_count * (double) trim(app_conf("INVITE_REFERRALS_RATE"));
                 }
                 if (intval(app_conf("REFERRAL_IP_LIMIT")) > 0 && $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user WHERE register_ip ='" . CLIENT_IP . "' AND pid='" . $user_data['pid'] . "'") > 0) {
                     $user_data['referral_rate'] = 0;
                 }
             } else {
                 $user_data['pid'] = 0;
             }
         }
     }
     //判断是否为手机注册
     if ((app_conf("REGISTER_TYPE") == 0 || app_conf("REGISTER_TYPE") == 1) && (app_conf("USER_VERIFY") == 0 || app_conf("USER_VERIFY") == 2)) {
         if (strim($user_data['sms_code']) == "") {
             showErr("请输入手机验证码");
         }
         //判断验证码是否正确
         if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "mobile_verify_code WHERE mobile='" . strim($user_data['mobile']) . "' AND verify_code='" . strim($user_data['sms_code']) . "' AND create_time + " . SMS_EXPIRESPAN . " > " . TIME_UTC . " ") == 0) {
             showErr("手机验证码出错,或已过期");
         }
         $user_data['is_effect'] = 1;
         $user_data['mobilepassed'] = 1;
     }
     //判断是否为邮箱注册
     if ((app_conf("REGISTER_TYPE") == 0 || app_conf("REGISTER_TYPE") == 2) && (app_conf("USER_VERIFY") == 1 || app_conf("USER_VERIFY") == 2)) {
         if (strim($user_data['emsms_code']) == "") {
             showErr("请输入邮箱验证码");
         }
         //判断验证码是否正确
         if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "email_verify_code WHERE email='" . strim($user_data['email']) . "' AND verify_code='" . strim($user_data['emsms_code']) . "' AND create_time + " . SMS_EXPIRESPAN . " > " . TIME_UTC . " ") == 0) {
             showErr("邮箱验证码出错,或已过期");
         }
         $user_data['is_effect'] = 1;
         $user_data['emailpassed'] = 1;
     }
     $res = save_user($user_data);
     if ($_REQUEST['subscribe'] == 1) {
         //订阅
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mail_list where mail_address = '" . $user_data['email'] . "'") == 0) {
             $mail_item['city_id'] = intval($_REQUEST['city_id']);
             $mail_item['mail_address'] = $user_data['email'];
             $mail_item['is_effect'] = app_conf("USER_VERIFY");
             $GLOBALS['db']->autoExecute(DB_PREFIX . "mail_list", $mail_item, 'INSERT', '', 'SILENT');
         }
         if ($user_data['mobile'] != '' && $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_list where mobile = '" . $user_data['mobile'] . "'") == 0) {
             $mobile['city_id'] = intval($_REQUEST['city_id']);
             $mobile['mobile'] = $user_data['mobile'];
             $mobile['is_effect'] = app_conf("USER_VERIFY");
             $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_list", $mobile, 'INSERT', '', 'SILENT');
         }
     }
     if ($res['status'] == 1) {
         $user_id = intval($res['data']);
         //更新来路
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set referer = '" . $GLOBALS['referer'] . "' where id = " . $user_id);
         $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
         if ($user_info['is_effect'] == 1) {
             //在此自动登录
             $result = do_login_user($user_data['user_name'], $user_data['user_pwd']);
             $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
             app_redirect(url("index", "user#steptwo"));
//.........这里部分代码省略.........
开发者ID:eliu03,项目名称:fanweP2P,代码行数:101,代码来源:userModule.class.php


注:本文中的save_user函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。