public function run() { $usr = new User(); $usr->username = "******"; $usr->password = "******"; $usr->role = "admin"; save_user($usr); }
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); } } }
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")); } }
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'); }
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'])); } }
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")); }
*/ 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) {
?> " 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
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']) != '') { $root['login_type'] = "Qq"; } $root['page_title'] = '注册'; $root['city_name'] = $city_name; output($root); }
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())); } }
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); } }
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); }
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']; } else { $name = $user_info_new['user_name']; } $result = do_login_user($name, $user_info_new['user_pwd']); ajax_return(array("status" => 1, "info" => $result['msg'], "jump" => url_wap("index"))); } else { ajax_return(array("status" => 0, "info" => "请等待管理员审核")); } }
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)) { $Conf->confirmMsg($successMsg . "<br />{$errorMsg}"); } else { if (count($success)) { $Conf->confirmMsg($successMsg); } else { if (count($errors)) { Conf::msg_error($errorMsg); } else { $Conf->warnMsg("Nothing to do."); } } } return count($errors) == 0; }
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")); } else { showSuccess($GLOBALS['lang']['WAIT_VERIFY_USER'], 0, APP_ROOT . "/"); } } 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); } }
public function binding_investor() { $ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { $return = array("status" => 1, 'info' => '', 'jump' => ''); } $is_investor = intval($_REQUEST['is_investor']); $identify_name = strim($_REQUEST['identify_name']); $identify_number = strim($_REQUEST['identify_number']); $identify_positive_image = strim($_REQUEST['identify_positive_image']); $identify_nagative_image = strim($_REQUEST['identify_nagative_image']); $identify_take_image = strim($_REQUEST['identify_take_image']); //============================= $verify = strim($_REQUEST['verify']); if ($identify_name == '') { showErr("身份证姓名不能为空!", $ajax, ""); } if ($identify_number == '') { showErr("身份证号码不能为空!", $ajax, ""); } if (!isCreditNo($identify_number)) { showErr("请输入正确的身份证号码!", $ajax, ""); } if ($identify_positive_image == '') { showErr("请上传身份证正面照片!", $ajax, ""); } if ($identify_nagative_image == '') { showErr("请上传身份证背面照片!", $ajax, ""); } if ($identify_take_image == '') { showErr("请上传本人持证照照片!", $ajax, ""); } if ($is_investor == 2) { $identify_business_name = strim($_REQUEST['identify_business_name']); $identify_business_licence = strim($_REQUEST['identify_business_licence']); $identify_business_code = strim($_REQUEST['identify_business_code']); $identify_business_tax = strim($_REQUEST['identify_business_tax']); if ($identify_business_name == '') { showErr("企业名称不能为空!", $ajax, ""); } if ($identify_business_licence == '') { showErr("营业执照不能为空!", $ajax, ""); } if ($identify_business_code == '') { showErr("组织机构代码证!", $ajax, ""); } if ($identify_business_tax == '') { showErr("税务登记证!", $ajax, ""); } } $condition = "mobile = '" . $GLOBALS['user_info']['mobile'] . "' and verify_code='" . $verify . "' "; $num = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where {$condition} ORDER BY id DESC"); if ($num <= 0) { showErr("验证码错误", $ajax, ""); } else { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id=" . $GLOBALS['user_info']['id']); if ($user_info) { require_once APP_ROOT_PATH . "system/libs/user.php"; $user_info['is_investor'] = $is_investor; if ($is_investor == 1) { $user_info['identify_business_name'] = ''; $user_info['identify_business_licence'] = ''; $user_info['identify_business_code'] = ''; $user_info['identify_business_tax'] = ''; } else { $user_info['identify_business_name'] = $identify_business_name; $user_info['identify_business_licence'] = $identify_business_licence; $user_info['identify_business_code'] = $identify_business_code; $user_info['identify_business_tax'] = $identify_business_tax; } $user_info['identify_name'] = $identify_name; $user_info['identify_number'] = $identify_number; $user_info['identify_positive_image'] = $identify_positive_image; $user_info['identify_nagative_image'] = $identify_nagative_image; $user_info['identify_take_image'] = $identify_take_image; if ($user_info['investor_status'] == 2) { $user_info['investor_status'] = 0; $user_info['investor_send_info'] = ''; } $user_info['user_pwd'] = ''; $res = save_user($user_info, "UPDATE"); showSuccess("保存成功", $ajax, url("settings#security")); } else { showErr("会员信息不存在", $ajax); } } }
public function ajax_setting() { //没有登录则跳转到login if (empty($this->user)) { app_redirect(url("index", "jsd_user#login")); } //检查发送类型 if (empty($_POST)) { $data['status'] = FALSE; $data['info'] = "请求失败"; ajax_return($data); } //更新类型 $update_type = isset($_POST['update_type']) ? $_POST['update_type'] : NULL; if (empty($update_type)) { $data['status'] = FALSE; $data['info'] = "当前无修改"; ajax_return($data); } $province_id = isset($_POST['province_id']) ? $_POST['province_id'] : NULL; $city_id = isset($_POST['city_id']) ? $_POST['city_id'] : NULL; $byear = isset($_POST['byear']) ? $_POST['byear'] : NULL; $bmonth = isset($_POST['bmonth']) ? $_POST['bmonth'] : NULL; $bday = isset($_POST['bday']) ? $_POST['bday'] : NULL; $email = isset($_POST['email']) ? $_POST['email'] : NULL; $address_detail = isset($_POST['address_detail']) ? $_POST['address_detail'] : NULL; $user_name = isset($_POST['user_name']) ? $_POST['user_name'] : NULL; $origin_pwd = isset($_POST['origin_pwd']) ? $_POST['origin_pwd'] : NULL; $new_pwd = isset($_POST['new_pwd']) ? $_POST['new_pwd'] : NULL; $new_pwd_rep = isset($_POST['new_pwd_rep']) ? $_POST['new_pwd_rep'] : NULL; switch ($update_type) { case SETTING_BASE_INFO: //检查基本信息是否正确 $is_passed = $this->_update_base_info_check($email, $address_detail, $user_name); if ($is_passed) { $update_data['province_id'] = $province_id; $update_data['city_id'] = $city_id; $update_data['byear'] = $byear; $update_data['bmonth'] = $bmonth; $update_data['bday'] = $bday; $update_data['email'] = $email; $update_data['address_detail'] = $address_detail; $update_data['user_name'] = $user_name; } break; case SETTING_PWD: //检查密码是否正确 $is_passed = $this->_update_pwd_check($origin_pwd, $new_pwd, $new_pwd_rep); if ($is_passed) { $update_data['user_pwd'] = $new_pwd; } break; case SETTING_BASE_INFO_PWD: //检查基本信息是否正确 $is_base_info_passed = $this->_update_base_info_check($email, $address_detail, $user_name); //检查密码是否正确 $is_pwd_passed = $this->_update_pwd_check($origin_pwd, $new_pwd, $new_pwd_rep); if (!empty($is_base_info_passed) && !empty($is_pwd_passed)) { $update_data['province_id'] = $province_id; $update_data['city_id'] = $city_id; $update_data['byear'] = $byear; $update_data['bmonth'] = $bmonth; $update_data['bday'] = $bday; $update_data['email'] = $email; $update_data['address_detail'] = $address_detail; $update_data['user_name'] = $user_name; $update_data['user_pwd'] = $new_pwd; } break; default: if (empty($email)) { $data['status'] = FALSE; $data['info'] = "当前无修改或者修改出错,请稍后重试"; ajax_return($data); } break; } $update_data['id'] = $this->user['id']; require_once APP_ROOT_PATH . "system/model/user.php"; $res = save_user($update_data, 'UPDATE'); if ($res['status'] == 1) { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = '" . intval($this->user['id']) . "'"); es_session::set("jsd_user_info", $user_info); $data['status'] = TRUE; $data['info'] = "更新成功"; ajax_return($data); } $data['status'] = FALSE; $data['info'] = "更新数据错误!"; ajax_return($data); }
<title>Создание пользователя</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> <h1>Создание пользователя</h1> <?php $login = '******'; $password = '******'; $result = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $login = $_POST['login'] ?: $login; if (!user_exists($login)) { $password = $_POST['password'] ?: $password; $hash = get_hash($password); if (save_user($login, $hash)) { $result = 'Хеш ' . $hash . ' успешно добавлен в файл'; } else { $result = 'При записи хеша ' . $hash . ' произошла ошибка'; } } else { $result = "Пользователь {$login} уже существует. Выберите другое имя."; } } ?> <h3><?php echo $result; ?> </h3> <form action="<?php echo $_SERVER['PHP_SELF'];
public function wx_do_register() { $user_info = array(); $referer = $_REQUEST['referer']; $user_info['mobile'] = strim($_REQUEST['mobile']); //$user_info['verify_coder']=strim($_REQUEST['code']); $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']); $user_pwd = $_REQUEST['password']; $user_new_pwd = $_REQUEST['new_password']; 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 ($user_pwd == "") { $data['status'] = 0; $data['info'] = "密码为空"; ajax_return($data); } if (strlen($user_pwd) < 4 || strlen($user_pwd) > 12) { $data['status'] = 0; $data['info'] = "密码请输入4~12个字符"; ajax_return($data); } if ($user_pwd != $user_new_pwd) { $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) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set wx_openid='" . $user_info['wx_openid'] . "' where id=" . $user['id']); $user_id = $user['id']; } else { /* 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); } $has_email=get_user_has('email',$user_info['email']); if($has_email){ $data['status'] = 0; $data['info'] = "邮箱已存在,请重新填写"; ajax_return($data); } */ $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") == 0 || app_conf("USER_VERIFY") == 2) { $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_pwd; //$GLOBALS['db']->autoExecute(DB_PREFIX."user",$user_info,"INSERT"); $res = save_user($user_info); statistics('register'); $user_id = intval($res['data']); } $user_info_new = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); if ($user_info_new['is_effect'] == 1) { $result = do_login_user($user_info_new['mobile'], $user_info_new['user_pwd']); ajax_return(array("status" => 1, "info" => $result['msg'], "jump" => $referer)); } else { if (app_conf("USER_VERIFY") == 1) { ajax_return(array("status" => 1, "jump" => url_wap("user#mail_check", array('uid' => $user_id)))); } else { if (app_conf("USER_VERIFY") == 3) { ajax_return(array("status" => 0, "info" => "请等待管理员审核")); } } } }
public function aqj_do_register() { //查询用户是否存在 $aqj_id = trim($_POST['reg_aqjid']); $aqj_mobile = trim($_POST['reg_m']); $result = array(); $xlc_user = $GLOBALS['db']->getRow("select id,mobile,user_pwd from " . DB_PREFIX . "user where mobile='" . $aqj_mobile . "'"); // print_r($xlc_user); 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); require_once APP_ROOT_PATH . "system/libs/user.php"; $result['status'] = 1; $result['data'] = "授权成功,正在为您登录..."; } else { //存在爱前进用户,更新绑定 $user_ap_partner = array(); $user_ap_partner['partner_user_id'] = $aqj_id; $user_ap_partner['edit_time'] = time(); $GLOBALS['db']->autoExecute(DB_PREFIX . "ap_partner_user", $user_ap_partner, "UPDATE", "id=" . intval($aqj_user['id'])); $result['status'] = 2; $result['data'] = "已授权,正在为您登录..."; } $result['jump'] = url_wap("deals", array('aqjid' => $aqj_id, 'm' => $aqj_mobile, 'isap' => 1)); ajax_return($result); } 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']); $result['data'] = "授权成功,正在为您登录..."; $result['jump'] = url_wap("deals", array('aqjid' => $aqj_id, 'm' => $aqj_mobile, 'isap' => 1)); send_auto_register_pwd($aqj_mobile, $user_data['user_pwd']); //send pwd message ajax_return($result); } }
function set_user($user_object, $fbuid) { $res = save_user($fbuid, $user_object); echo json_encode($res); }
public function save_password() { $ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { showErr("", $ajax, url("user#login")); } if (!check_ipop_limit(get_client_ip(), "setting_save_password", 5)) { showErr("提交太频繁", $ajax, ""); } $user_pwd = strim($_REQUEST['user_pwd']); $confirm_user_pwd = strim($_REQUEST['confirm_user_pwd']); if (strlen($user_pwd) < 4) { showErr("密码不能低于四位", $ajax, ""); } if ($user_pwd != $confirm_user_pwd) { showErr("密码确认失败", $ajax, ""); } require_once APP_ROOT_PATH . "system/libs/user.php"; $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])); $user_info['user_pwd'] = $user_pwd; save_user($user_info, "UPDATE"); showSuccess("保存成功", $ajax, ""); //$res = save_user($user_data); }
public function binding_investor() { $ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { $return = array("status" => 1, 'info' => '', 'jump' => ''); } $is_investor = intval($_REQUEST['is_investor']); $identify_name = strim($_REQUEST['identify_name']); $identify_number = strim($_REQUEST['identify_number']); $identify_positive_image = strim($_REQUEST['identify_positive_image']); $identify_nagative_image = strim($_REQUEST['identify_nagative_image']); //============================= $verify = strim($_REQUEST['verify']); if ($identify_name == '') { showErr("身份证姓名不能为空!", $ajax, ""); } if ($identify_number == '') { showErr("身份证号码不能为空!", $ajax, ""); } if (!isCreditNo($identify_number)) { showErr("请输入正确的身份证号码!", $ajax, ""); } if ($identify_positive_image == '' && app_conf('IDENTIFY_POSITIVE')) { showErr("请上传身份证正面照片!", $ajax, ""); } if ($identify_nagative_image == '' && app_conf('IDENTIFY_NAGATIVE')) { showErr("请上传身份证背面照片!", $ajax, ""); } //判断该实名是否存在 if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user where (identify_name = '{$identify_name}' or identify_number = '{$identify_number}') and id<>" . $GLOBALS['user_info']['id']) > 0) { showErr("该实名已被其他用户认证,非本人请联系客服", $ajax, ""); } if ($is_investor == 2) { $identify_business_name = strim($_REQUEST['identify_business_name']); $identify_business_licence = strim($_REQUEST['identify_business_licence']); $identify_business_code = strim($_REQUEST['identify_business_code']); $identify_business_tax = strim($_REQUEST['identify_business_tax']); if ($identify_business_name == '') { showErr("企业名称不能为空!", $ajax, ""); } if ($identify_business_licence == '' && app_conf('BUSINESS_LICENCE')) { showErr("营业执照不能为空!", $ajax, ""); } if ($identify_business_code == '' && app_conf('BUSINESS_CODE')) { showErr("组织机构代码证!", $ajax, ""); } if ($identify_business_tax == '' && app_conf('BUSINESS_TAX')) { showErr("税务登记证!", $ajax, ""); } } /*$condition="mobile = '".$GLOBALS['user_info']['mobile']."' and verify_code='".$verify."' "; $num=$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."mobile_verify_code where $condition ORDER BY id DESC"); */ $num = 1; if ($num <= 0) { showErr("验证码错误", $ajax, ""); } else { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id=" . $GLOBALS['user_info']['id']); unset($user_info['user_pwd']); if ($user_info) { require_once APP_ROOT_PATH . "system/libs/user.php"; $user_info['is_investor'] = $is_investor; if ($is_investor == 1) { $user_info['identify_business_name'] = ''; $user_info['identify_business_licence'] = ''; $user_info['identify_business_code'] = ''; $user_info['identify_business_tax'] = ''; } else { $user_info['identify_business_name'] = $identify_business_name; $user_info['identify_business_licence'] = $identify_business_licence; $user_info['identify_business_code'] = $identify_business_code; $user_info['identify_business_tax'] = $identify_business_tax; } $user_info['identify_name'] = $identify_name; $user_info['identify_number'] = $identify_number; $user_info['identify_positive_image'] = $identify_positive_image; $user_info['identify_nagative_image'] = $identify_nagative_image; $user_info['investor_status'] = 0; $user_info['investor_send_info'] = ''; $res = save_user($user_info, "UPDATE"); showSuccess("保存成功", $ajax, url("settings#security")); } else { showErr("会员信息不存在", $ajax); } } }
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")); } if ($_REQUEST['changed_service_type_id'] != $_REQUEST['service_type_id']) { $_REQUEST['service_type_id'] = $_REQUEST['changed_service_type_id']; //修改service_type_id $_REQUEST['belong_to_manager_id'] = 'set_null'; //修改p_id } $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")); } } } if (isset($_REQUEST['tech_list'])) { $tech_list = $_REQUEST['tech_list']; M('DealTech')->where(array('tech_id' => $data['id']))->delete(); foreach ($tech_list as $key => $value) { M('DealTech')->add(array('tech_id' => $data['id'], 'deal_id' => $value)); } } //开始更新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")); }
echo send_shout($tw_user, $tw_pass, $shout, $location); } elseif ($func == 'load_state') { require_once 'db/db_functions.php'; $data = retrieve_user_data("test_user"); header("Content-type: text/javascript"); if ($data == null) { echo json_encode('NO_SAVED_STATE'); } else { $data = unserialize($data['state']); $_SESSION['panels'] = $data['panels']; $_SESSION['panels_data'] = $data['panels_data']; echo json_encode("LOADED_SAVED_STATE"); } } elseif ($func == 'save_state') { //save the session data to the user's openid in the db require_once 'db/db_functions.php'; $_SESSION['panels_data'] = $_REQUEST['panels_data']; save_user($_SESSION['user_openid'], serialize($_SESSION)); //save_user("test_user","test_data"); header("Content-type: text/javascript"); echo json_encode("SAVED_USER"); //echo var_dump($_SESSION); } elseif ($func == 'logout') { unset($_SESSION); session_destroy(); echo "Loggged out"; } function save_user_pref($pref_name, $pref_value) { $_SESSION['user_prefs'][$pref_name] = $pref_value; }
<?php include 'utils/db.php'; $user_id = check_user($_POST['email']); if ($user_id > 0) { header('Location: index.php?page=register&e=E'); } else { $result = save_user($_POST); header('Location: index.php?o=R'); }
break; case 'showusers': if ($valuser->isadmin()) { show_users(); } break; case 'userdel': if ($valuser->isadmin() && frm_ok('id', 1)) { db_execquery('DELETE FROM ' . TBL_USERS . ' WHERE u_id = ' . frm_get('id', 1)); show_users(); } break; case 'usersave': if ($valuser->isadmin()) { if (frm_isset('submit')) { save_user(); } else { show_users(); } } break; case 'newusertemplate': if ($valuser->isadmin() && frm_ok('id', 1)) { $id = frm_get('id', 1); $kpu = new kpuser(); if ($kpu->load($id)) { $kpu->id = -1; $kpu->set('u_login', ''); $kpu->set('utemplate', 0); show_userform($kpu, '', 0, $id); }
public function save() { require_once APP_ROOT_PATH . 'system/libs/user.php'; foreach ($_REQUEST as $k => $v) { $_REQUEST[$k] = htmlspecialchars(addslashes(trim($v))); } if ($_REQUEST['sta'] == 1) { if (md5(strim($_REQUEST['old_password']) . $GLOBALS['user_info']['code']) != $GLOBALS['user_info']['user_pwd']) { showErr("旧密码错误!", intval($_REQUEST['is_ajax'])); } } if (intval($_REQUEST['id']) == 0) { $_REQUEST['id'] = intval($GLOBALS['user_info']['id']); } if (!isset($_REQUEST['user_name'])) { $_REQUEST['user_name'] = $_REQUEST['old_user_name'] = $GLOBALS['user_info']['user_name']; } if (!isset($_REQUEST['email'])) { $_REQUEST['email'] = $_REQUEST['old_email'] = $GLOBALS['user_info']['email']; } $_REQUEST['old_password'] = strim($_REQUEST['old_password']); $res = save_user($_REQUEST, 'UPDATE'); if ($res['status'] == 1) { $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) { showSuccess($GLOBALS['lang']['SUCCESS_TITLE'], 1); } else { app_redirect(url("index", "uc_account#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'])); } }
public function agencies_update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("user_name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/agencies_edit", array("id" => $data['id']))); if (!check_empty($data['user_pwd']) && $data['user_pwd'] != $_REQUEST['user_confirm_pwd']) { $this->error(L("USER_PWD_CONFIRM_ERROR")); } if (!check_empty($data['idno'])) { $this->error(sprintf(L("USER_EMPTY_ERROR"), L("IPS_IDENT_TYPE_1"))); } if (!check_empty($data['real_name'])) { $this->error(sprintf(L("USER_EMPTY_ERROR"), L("REAL_NAME"))); } $_REQUEST["user_type"] = 3; $_REQUEST["idcardpassed"] = 1; $_REQUEST["idcardpassed_time"] = TIME_UTC; $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['field_name'] == 'idno') { $this->error(L("USER_IDNO_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")); } if ($error_field['field_name'] == 'mobile') { $this->error(L("USER_MOBILE_EXIST_TIP")); } if ($error_field['field_name'] == 'idno') { $this->error(L("USER_IDNO_EXIST_TIP")); } } } //更新权限 M("UserAuth")->where("user_id=" . $data['id'] . " and rel_id = 0")->delete(); foreach ($_REQUEST['auth'] as $k => $v) { foreach ($v as $item) { $auth_data = array(); $auth_data['m_name'] = $k; $auth_data['a_name'] = $item; $auth_data['user_id'] = $data['id']; M("UserAuth")->add($auth_data); } } //开始更新is_effect状态 M("User")->where("id=" . intval($_REQUEST['id']))->setField("is_effect", intval($_REQUEST['is_effect'])); $user_id = intval($_REQUEST['id']); M("UserCateLink")->where("user_id=" . $user_id)->delete(); foreach ($_REQUEST['cate_id'] as $cate_id) { $link_data = array(); $link_data['user_id'] = $user_id; $link_data['cate_id'] = $cate_id; M("UserCateLink")->add($link_data); } save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); }
public function save_mobile_password() { //$ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $data = array(); if (!check_ipop_limit(get_client_ip(), "setting_save_mobile_password", 5)) { $data['info'] = "提交太频繁"; ajax_return($data); return false; } //showErr("提交太频繁",$ajax,""); $user_pwd = strim($_REQUEST['user_pwd']); $confirm_user_pwd = strim($_REQUEST['confirm_user_pwd']); $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])); $mobile = strim($user_info['mobile']); $user_info['verify_coder'] = strim($_REQUEST['verify_coder']); if ($mobile) { $has_code = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile='" . $mobile . "' and verify_code='" . strim($_REQUEST['verify_coder']) . "' "); if (!$has_code) { //showErr("验证码错误",$ajax,""); $data['info'] = "验证码错误"; ajax_return($data); return false; } } else { //showErr("请绑定手机号",$ajax,""); $data['info'] = "请绑定手机号"; ajax_return($data); return false; } if (strlen($user_pwd) < 4) { //showErr("密码不能低于四位",$ajax,""); $data['info'] = "密码不能低于四位"; ajax_return($data); return false; } if ($user_pwd != $confirm_user_pwd) { //showErr("密码确认失败",$ajax,""); $data['info'] = "密码确认失败"; ajax_return($data); return false; } require_once APP_ROOT_PATH . "system/libs/user.php"; $user_info['user_pwd'] = $user_pwd; save_user($user_info, "UPDATE"); if ($GLOBALS['db']->query("update " . DB_PREFIX . "user set password_verify = '' where id = " . intval($GLOBALS['user_info']['id']))) { $data['status'] = 1; } else { $data['status'] = 0; } ajax_return($data); //showSuccess("保存成功",$ajax,url_wap("settings#index")); }