本文整理汇总了PHP中user_register函数的典型用法代码示例。如果您正苦于以下问题:PHP user_register函数的具体用法?PHP user_register怎么用?PHP user_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_register函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: login_receive
function login_receive()
{
login_check();
if (isset($_GET['lostpassword'])) {
login_password_recovery_receive();
}
if (isset($_GET['reg']) && isset($_POST['upsign'])) {
user_register();
}
}
开发者ID:carriercomm,项目名称:shell-2,代码行数:10,代码来源:login.php
示例2: registration
function registration($login, $password1, $password2, $email)
{
//++
$verification_data_err = verification_reg_data($login, $password1, $password2, $email);
if ($verification_data_err) {
$feedback = $verification_data_err;
} else {
$password = $password1;
prepare_reg_data(&$login, &$password, &$email);
$salt = salting();
$hash = crypt($password, $salt);
$feedback = user_register($login, $hash, $salt, $email);
}
return $feedback;
}
开发者ID:MOACL,项目名称:moacl.ru,代码行数:15,代码来源:functions.php
示例3: explode
if (!empty($role)) {
$role_perms = explode(',', $role['perms']);
}
$user_perms = explode(',', $item['perms']);
}
if ($_W['isajax'] && $_W['ispost']) {
$data = array('uniacid' => $_W['uniacid'], 'username' => trim($_GPC['username']), 'realname' => trim($_GPC['realname']), 'mobile' => trim($_GPC['mobile']), 'password' => user_hash($_GPC['password'], random(8)), 'roleid' => intval($_GPC['roleid']), 'status' => intval($_GPC['status']), 'perms' => is_array($_GPC['perms']) ? implode(',', $_GPC['perms']) : '');
if (!empty($id)) {
user_update(array('uid' => $data['uid'], 'password' => $_GPC['password']));
pdo_update('ewei_shop_perm_user', $data, array('id' => $id, 'uniacid' => $_W['uniacid']));
plog('perm.user.edit', "编辑操作员 ID: {$id} 用户名: {$data['username']} ");
} else {
if (user_check(array('username' => $data['username']))) {
die(json_encode(array('result' => 0, 'message' => '非常抱歉,此用户名已经被注册,你需要更换注册名称!')));
}
$data['uid'] = user_register(array('username' => $data['username'], 'password' => $_GPC['password']));
pdo_insert('ewei_shop_perm_user', $data);
pdo_insert('uni_account_users', array('uid' => $data['uid'], 'uniacid' => $data['uniacid'], 'role' => 'operator'));
$id = pdo_insertid();
plog('perm.user.add', "添加操作员 ID: {$id} 用户名: {$data['username']} ");
}
die(json_encode(array('result' => 1)));
}
} elseif ($operation == 'delete') {
ca('perm.user.delete');
$id = intval($_GPC['id']);
$item = pdo_fetch("SELECT id,uid,username FROM " . tablename('ewei_shop_perm_user') . " WHERE id = '{$id}'");
if (empty($item)) {
message('抱歉,操作员不存在或是已经被删除!', $this->createPluginWebUrl('perm/user', array('op' => 'display')), 'error');
}
pdo_delete('users', array('uid' => $item['uid']));
开发者ID:noikiy,项目名称:mygit,代码行数:31,代码来源:user.php
示例4: user_register
$error = '<div style="margin-top:-10px;margin-left:10px;">Your password needs to be <br>atleast 5 characters</div>';
include 'index.php';
exit;
}
// Check if the passwords match
if ($_POST['email'] != $_POST['confirmemail']) {
// Reshow the form with an error
$error = 'Your emails do not match';
include 'index.php';
exit;
}
$username = $_POST['username'];
if (mysql_num_rows(mysql_query("SELECT username FROM user WHERE username = '{$username}'"))) {
$error = 'The username already exists';
include 'index.php';
exit;
}
if (mysql_num_rows(mysql_query("SELECT username FROM user WHERE email = '{$email}'"))) {
$error = 'The email already exists';
include 'index.php';
exit;
}
if (mysql_num_rows(mysql_query("SELECT username FROM user WHERE youtubeUserName = '{$youtubeUserName}'"))) {
$error = 'The youtube name already exists';
include 'index.php';
exit;
}
// Everything is ok, register
user_register($_POST['username'], $_POST['password'], $_POST['email'], $_POST['youtubeUserName']);
header('Location: index.php?f=sf');
}
开发者ID:danielheyman,项目名称:EazySubs,代码行数:31,代码来源:registerBody.php
示例5: sprintf
$subject = $lang_module['account_register'];
$message = sprintf($lang_module['account_register_info'], $array_register['first_name'], $global_config['site_name'], NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true), $array_register['username']);
nv_sendmail($global_config['site_email'], $array_register['email'], $subject, $message);
if (!empty($global_config['auto_login_after_reg'])) {
// Auto login
$array_user = array('userid' => $userid, 'last_agent' => '', 'last_ip' => '', 'last_login' => 0, 'last_openid' => '');
validUserLog($array_user, 1, '');
$nv_redirect = nv_redirect_decrypt($nv_redirect);
$url = !empty($nv_redirect) ? $nv_redirect : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
} else {
$url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=login';
if (!empty($nv_redirect)) {
$url .= '&nv_redirect=' . $nv_redirect;
}
}
$nv_redirect = '';
die(reg_result(array('status' => 'ok', 'input' => nv_url_rewrite($url, true), 'mess' => $lang_module['register_ok'])));
}
}
}
if ($nv_Request->isset_request('get_usage_terms', 'post')) {
$sql = "SELECT content FROM " . NV_USERS_GLOBALTABLE . "_config WHERE config='siteterms_" . NV_LANG_DATA . "'";
$siteterms = $db->query($sql)->fetchColumn();
include NV_ROOTDIR . '/includes/header.php';
echo $siteterms;
include NV_ROOTDIR . '/includes/footer.php';
}
$contents = user_register($gfx_chk, $array_register['checkss'], $data_questions, $array_field_config, $custom_fields);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
开发者ID:NukeVietCMS,项目名称:CodeWeb,代码行数:31,代码来源:register.php
示例6: mysqli_connect
*/
//error_reporting(E_ALL);
//ini_set('display_errors', 'On');
$rootdir = "/";
include $_SERVER['DOCUMENT_ROOT'] . $rootdir . "/php/base.php";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dblogin) or die("ERROR: Can't connect to MySQL DB: " . mysql_error());
if (isset($_GET["action"])) {
switch ($_GET["action"]) {
case "check":
user_check();
break;
case "login":
user_login();
break;
case "register":
user_register();
break;
case "remind":
user_remind();
break;
case "update":
user_update();
break;
case "logout":
user_logout();
break;
}
}
function user_check()
{
if ($_SESSION['LoggedIn'] == 1) {
开发者ID:katjaq,项目名称:braincatalogue,代码行数:31,代码来源:login.php
示例7: user_login_openid_agree
case 'login_openid2':
user_login_openid_agree(isset($_POST['agree']));
log_timing();
header('Location:index.php');
exit;
case 'logout':
user_logout();
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'login.php') === false) {
header('Location:' . $_SERVER['HTTP_REFERER']);
} else {
header('Location:index.php');
}
log_timing();
exit;
case 'reg_done':
$reg_status = user_register($_POST);
if ($reg_status == 1) {
header("Location:index.php");
exit;
} else {
$smarty->assign('reg_status', $reg_status);
}
break;
case 'change_pw':
$smarty->assign('change_status', user_change_password($_POST));
break;
case 'change_email':
$smarty->assign('change_status', user_change_email($_POST));
break;
case 'generate_passwd':
$smarty->assign('gen_status', user_generate_password($_POST['email']));
开发者ID:ayunah,项目名称:opencorpora,代码行数:31,代码来源:login.php
示例8: activate_user
function activate_user($usname, $pwd, $email, $member_type, $mobile)
{
global $timestamp, $online_ip;
if (defined('UC_API')) {
include_once QISHI_ROOT_PATH . 'uc_client/client.php';
list($activateuid, $username, $password, $email) = uc_user_login($usname, $pwd);
if ($activateuid > 0) {
return user_register(4, $pwd, $member_type, $email, $mobile, false, $usname);
} else {
return -10;
}
}
return false;
}
开发者ID:winiceo,项目名称:job,代码行数:14,代码来源:fun_user.php
示例9: trim
if (in_array("email", $reg_com_config) && $reg_type == 1) {
$com_setarr['email'] = $_POST['reg_email'] ? trim($_POST['reg_email']) : showmsg("请输入企业联系邮箱");
}
if (in_array("address", $reg_com_config)) {
$com_setarr['address'] = $_POST['address'] ? trim($_POST['address']) : showmsg("请输入企业详细地址");
}
if (in_array("contents", $reg_com_config)) {
$com_setarr['contents'] = $_POST['contents'] ? trim($_POST['contents']) : showmsg("请输入企业介绍");
}
}
if ($reg_type == 1) {
$mobile = $_POST['mobile'] ? trim($_POST['mobile']) : showmsg("注册手机号丢失");
$rst = user_register($reg_type, $password, $member_type, "", $mobile, false);
} else {
$email = $_POST['email'] ? trim($_POST['email']) : showmsg("注册邮箱号丢失");
$rst = user_register($reg_type, $password, $member_type, $email, "", $uc_reg = true);
}
if ($rst > 0) {
$user = get_user_inid($rst);
// 企业信息
if ($member_type == 1 && !empty($com_setarr)) {
$com_setarr['uid'] = intval($rst);
$com_setarr['audit'] = intval($_CFG['audit_add_com']);
$com_setarr['addtime'] = $timestamp;
$com_setarr['refreshtime'] = $timestamp;
$db->inserttable(table('company_profile'), $com_setarr);
}
$login_js = user_login($user['username'], $password);
$mailconfig = get_cache('mailconfig');
if ($mailconfig['set_reg'] == "1") {
switch ($user['utype']) {
开发者ID:winiceo,项目名称:job,代码行数:31,代码来源:user_reg.php
示例10: elseif
} elseif ($password != $_POST['password1']) {
$err = "两次输入的密码不同";
} elseif (empty($email) || !ereg("^[-a-zA-Z0-9_\\.]+\\@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$", $email)) {
$err = "电子邮箱格式错误";
}
if (get_user_inusername($username)) {
$err = "用户名已经存在";
}
if (get_user_inemail($email)) {
$err = "电子邮箱已经存在";
}
if ($err) {
$smarty->assign('err', $err);
$smarty->assign('type', $member_type);
$smarty->display("wap/reg_form.html");
exit;
}
$register = user_register(3, $password, $member_type, $email, $mobile = "", true, $username, "");
if ($register > 0) {
$login_js = wap_user_login($username, $password);
$mailconfig = get_cache('mailconfig');
if ($mailconfig['set_reg'] == "1") {
dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid=" . $_SESSION['uid'] . "&key=" . asyn_userkey($_SESSION['uid']) . "&sendemail=" . $email . "&sendusername=" . $username . "&sendpassword=" . $password . "&act=reg");
}
if ($login_js) {
header("location:" . $login_js['qs_login']);
}
} else {
header("location:wap_user_reg.php");
}
}
开发者ID:source-hunter,项目名称:74cms,代码行数:31,代码来源:wap_user_reg.php
示例11: mysql_real_escape_string
# For details see the file LICENSE.html in the top level of the source.
require_once "../database.inc";
require_once "user.inc";
$user_name = mysql_real_escape_string($_POST["user_name"]);
$password1 = mysql_real_escape_string($_POST["password1"]);
$password2 = mysql_real_escape_string($_POST["password2"]);
$email = mysql_real_escape_string($_POST["email"]);
$real_name = mysql_real_escape_string($_POST["real_name"]);
$submit = mysql_real_escape_string($_POST["submit"]);
if (user_isloggedin()) {
user_logout();
$user_name = '';
}
$ok = false;
if ($submit) {
$ok = user_register($user_name, $password1, $password2, $email, $real_name);
}
$title = "Sign up for Newsletter, Forum and Policies";
$onload = "givefocus('real_name')";
pw_header();
if ($feedback) {
if ($ok) {
echo "<p>{$feedback}</p>";
} else {
echo "<div class=\"error\"><h2>Registration not complete,\n please try again</h2><p>{$feedback}</div>";
}
} else {
print "<p>\n Quickly fill in the information below, and we'll send you\n a confirmation email. You will then receive the Public\n Whip newsletter, which will be at most once a month.\n Occasionally we will send an extra small topical newsletter.\n You will also be able to edit division descriptions and policies. After\n signing up you can unsubscribe from the newsletter, but still\n edit divisions and policies.";
print "<p><a href=\"../newsletters/archive.php\">Read archive of previous newsletters</a>";
print "<br><a href=\"settings.php\">Log in to change settings if you already signed up</a>";
}
开发者ID:damncabbage,项目名称:publicwhip,代码行数:31,代码来源:register.php
示例12: user_register
<?php
require 'js/parse/autoload.php';
require_once "config.php";
require_once "common.php";
use Parse\ParseException;
use Parse\ParseUser;
use Parse\ParseSessionStorage;
use Parse\ParseClient;
use Parse\ParseQuery;
use Parse\ParseObject;
$func = $_POST['check'];
if ($func == 'register') {
echo user_register($_POST['username'], $_POST['first'], $_POST['last'], $_POST['password'], $_POST['email'], $_POST['location'], $_POST['lat'], $_POST['lng']);
mail_box($_POST['email'], 'Register', 'Thank you for registering', 'register');
}
if ($func == 'guest') {
(string) ($uniq = uniqid());
$name = "Guest-" . $uniq;
$user = new ParseUser();
$user->set("username", $name);
$user->set("password", $uniq);
$user->setArray("connected", []);
$user->set("status", 0);
$user->set("avatar", "img/profile_default_male.jpg");
$response = new Response();
try {
$user->signUp();
//user_register_create_chat($user);
$_SESSION['user'] = $user;
$_SESSION['notification'] = true;
开发者ID:louk,项目名称:One-Nice-Thing,代码行数:31,代码来源:user.php
示例13: header
} else {
if (strlen($userpass) < 8) {
$errors[] = "votre mot de passe doit comporter au minimum 8 caractères";
} else {
$sql = 'SELECT user_name , user_email FROM users where user_name=:user OR user_email=:email';
try {
$stmt = $db_connexion->prepare($sql);
$stmt->execute(array(':user' => $username, ':email' => $usermail));
$row = $stmt->fetch();
if ($row["user_name"] == $username) {
$errors[] = "le pseudo a déjà été pris";
} else {
if ($row["user_email"] == $usermail) {
$errors[] = "L'email a déjà été renseigné";
} else {
if (user_register($username, $usermail, $userpass, $db_connexion)) {
header("Location:inscription.php?succes");
}
}
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//
开发者ID:amine142,项目名称:userprofil,代码行数:31,代码来源:inscription.php
示例14: elseif
}
} elseif ($act == 'phone_reg') {
$_POST = array_map("utf8_to_gbk", $_POST);
require_once QISHI_ROOT_PATH . 'include/fun_wap.php';
require_once QISHI_ROOT_PATH . 'include/fun_user.php';
$mobile = trim($_POST['mobile']);
$password_mobile = isset($_POST['password_mobile']) ? trim($_POST['password_mobile']) : "";
$member_type = intval($_POST['utype']);
$agreement_mobile = isset($_POST['agreement_mobile']) ? intval($_POST['agreement_mobile']) : "";
if (empty($mobile) || empty($password_mobile) || empty($member_type)) {
exit("信息不完整!");
} elseif (empty($agreement_mobile)) {
exit("需要同意注册协议");
}
//验证验证码是否正确
$verifycode = trim($_POST['verifycode']);
if (empty($verifycode) || empty($_SESSION['mobile_rand']) || $verifycode != $_SESSION['mobile_rand']) {
exit("验证码错误!");
}
//手机号注册
$register = user_register(1, $password_mobile, $member_type, $email = "", $mobile, false, $username = "", "");
if ($register > 0) {
$user_info = get_user_inmobile($mobile);
$login_js = wap_user_login($user_info['username'], $password_mobile);
if ($login_js) {
exit($login_js['qs_login']);
}
} else {
exit("user_reg.php");
}
}
开发者ID:winiceo,项目名称:job,代码行数:31,代码来源:user_reg.php
示例15: defined
/**
* [Weizan System] Copyright (c) 2014 012WZ.COM
* Weizan is NOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details.
*/
defined('IN_IA') or exit('Access Denied');
$_W['page']['title'] = '添加用户 - 用户管理 - 用户管理';
if (checksubmit()) {
load()->model('user');
$user = array();
$user['username'] = trim($_GPC['username']);
if (!preg_match(REGULAR_USERNAME, $user['username'])) {
message('必须输入用户名,格式为 3-15 位字符,可以包括汉字、字母(不区分大小写)、数字、下划线和句点。');
}
if (user_check(array('username' => $user['username']))) {
message('非常抱歉,此用户名已经被注册,你需要更换注册名称!');
}
$user['password'] = $_GPC['password'];
if (istrlen($user['password']) < 8) {
message('必须输入密码,且密码长度不得低于8位。');
}
$user['remark'] = $_GPC['remark'];
$user['groupid'] = intval($_GPC['groupid']) ? intval($_GPC['groupid']) : message('请选择所属用户组');
$uid = user_register($user);
if ($uid > 0) {
unset($user['password']);
message('用户增加成功!', url('user/edit', array('uid' => $uid)));
}
message('增加用户失败,请稍候重试或联系网站管理员解决!');
}
$groups = pdo_fetchall("SELECT id, name FROM " . tablename('users_group') . " ORDER BY id ASC");
template('user/create');
开发者ID:6662680,项目名称:qday_wx,代码行数:31,代码来源:create.ctrl.php
示例16: message
message('“' . $row['title'] . '”此项为必填项,请返回填写完整!');
}
$profile[$row['field']] = $_GPC[$row['field']];
}
}
if (!empty($setting['register']['code'])) {
$code = $_GPC['code'];
$hash = md5($code . $_W['config']['setting']['authkey']);
if ($_GPC['__code'] != $hash) {
message('你输入的验证码不正确, 请重新输入.');
}
}
$member['status'] = !empty($setting['register']['verify']) ? -1 : 0;
$member['remark'] = '';
$member['groupid'] = intval($setting['register']['groupid']);
$uid = user_register($member);
if ($uid > 0) {
unset($member['password']);
$member['uid'] = $uid;
if (!empty($profile)) {
$profile['uid'] = $uid;
$profile['createtime'] = TIMESTAMP;
pdo_insert('users_profile', $profile);
}
pdo_update('users_invitation', array('inviteuid' => $uid), array('id' => $invite['id']));
message('注册成功' . (!empty($setting['register']['verify']) ? ',請等待管理员审核!' : ',请重新登录!'), url('user/login', array('uid' => $uid, 'username' => $member['username'])));
}
message('增加用户失败,请稍候重试或联系网站管理员解决!');
}
load()->func('tpl');
template('user/register');
开发者ID:ruige123456,项目名称:dataMining,代码行数:31,代码来源:register.ctrl.php
示例17: user_register
/* SERVICE: Register */
} else {
if (isset($_GET['action']) && $_GET['action'] == 'register') {
if (!isset($_POST["username"]) || !isset($_POST["password"])) {
$xml_output .= "<code>Missing info</code>";
} else {
$username = $_POST["username"];
$password = $_POST["password"];
//die($username.$password);
if (!isset($_POST["email"])) {
$email = "";
} else {
$email = $_POST["email"];
}
//die($email);
$result = user_register($username, $password, $email, $mysqli);
//$result = user_register($username, $password, $email, $mysqli);
$xml_output .= "<code>" . $result . "</code>";
}
/* SERVICE: Query user basic information */
} else {
if (isset($_GET['action']) && $_GET['action'] == 'query') {
if (isset($_GET['username'])) {
$username = $_GET['username'];
$user = user_query($username, $mysqli);
if ($user != null) {
$xml_output .= "<code>OK</code>";
$xml_output .= "<user_info>";
$xml_output .= "<id>" . $user['id'] . "</id>";
$xml_output .= "<username>" . $user['username'] . "</username>";
$xml_output .= "<email>" . $user['email'] . "</email>";
开发者ID:JobsSteve,项目名称:rushgame,代码行数:31,代码来源:user.php
示例18: switch
switch ($url_parts[3]) {
case "listmode":
preferences_list_mode();
header("Location: " . $_SERVER["HTTP_REFERER"]);
break;
case "tilemode":
preferences_tile_mode();
header("Location: " . $_SERVER["HTTP_REFERER"]);
break;
}
break;
case "user":
require_once "lib/api/users.php";
switch ($url_parts[3]) {
case "register":
$result = user_register();
if ($result > 0) {
header("Location: /welcome");
} else {
header("Location: /register/failure/" . $result);
//print $result;
}
break;
case "logout":
user_logout();
header("Location: /");
break;
case "login":
if (user_login()) {
header("Location: /" . $_SESSION["user_name"]);
} else {
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:31,代码来源:index.php
示例19: isset
$member_type = isset($_POST['member_type']) ? intval($_POST['member_type']) : exit("err");
$email = isset($_POST['email']) ? trim($_POST['email']) : exit("err");
if (strcasecmp(QISHI_DBCHARSET, "utf8") != 0) {
$username = utf8_to_gbk($username);
$password = utf8_to_gbk($password);
}
if (defined('UC_API')) {
include_once QISHI_ROOT_PATH . 'uc_client/client.php';
if (uc_user_checkname($username) < 0) {
exit("err");
}
if (uc_user_checkemail($email) < 0) {
exit("err");
}
}
$register = user_register($username, $password, $member_type, $email);
if ($register > 0) {
$login_js = user_login($username, $password);
$mailconfig = get_cache('mailconfig');
if ($mailconfig['set_reg'] == "1") {
dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid=" . $_SESSION['uid'] . "&key=" . asyn_userkey($_SESSION['uid']) . "&sendemail=" . $email . "&sendusername=" . $username . "&sendpassword=" . $password . "&act=reg");
}
$ucjs = $login_js['uc_login'];
$qsurl = $login_js['qs_login'];
$qsjs = "<script language=\"javascript\" type=\"text/javascript\">window.location.href=\"" . $qsurl . "\";</script>";
if ($ucjs || $qsurl) {
exit($ucjs . $qsjs);
} else {
exit("err");
}
} else {
开发者ID:winiceo,项目名称:job,代码行数:31,代码来源:ajax_user.php
示例20: doWebbusment
public function doWebbusment()
{
global $_W, $_GPC;
checklogin();
load()->func('tpl');
$uniacid = $_W['uniacid'];
$op = $_GPC['op'] ? $_GPC['op'] : 'display';
if ($op == 'display') {
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$goodses = pdo_fetchall("SELECT * FROM " . tablename('eso_sale_busment') . " WHERE uniacid = '{$_W['uniacid']}' ORDER BY uid DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('eso_sale_busment') . " WHERE uniacid = '{$_W['uniacid']}'");
$pager = pagination($total, $pindex, $psize);
include $this->template('busment_show');
} elseif ($op == 'add') {
$uid = intval($_GPC['uid']);
if (!empty($uid)) {
$sql = 'SELECT * FROM ' . tablename('eso_sale_busment') . ' WHERE uid=:uid AND uniacid=:uniacid LIMIT 1';
$params = array(':uid' => $uid, ':uniacid' => $_W['uniacid']);
$goods = pdo_fetch($sql, $params);
if (empty($goods)) {
message('未找到指定的商户.', $this->createWebUrl('busment'));
}
}
if (checksubmit()) {
$data = $_GPC['goods'];
// 获取打包值
empty($data['title']) && message('请填写商户名称');
empty($data['bond']) && message('请填写商户保证金');
empty($data['username']) && message('请填写登陆账号');
empty($data['password']) && message('请填写登陆密码');
if (empty($goods)) {
//添加管理人员
load()->model('user');
$user = array();
$user['username'] = trim($data['username']);
if (!preg_match(REGULAR_USERNAME, $user['username'])) {
message('必须输入用户名,格式为 3-15 位字符,可以包括汉字、字母(不区分大小写)、数字、下划线和句点。');
}
if (user_check(array('username' => $user['username']))) {
message('非常抱歉,此用户名已经被注册,你需要更换注册名称!');
}
$user['password'] = $data['password'];
if (istrlen($user['password']) < 8) {
message('必须输入密码,且密码长度不得低于8位。');
}
$user['remark'] = '';
$user['groupid'] = 1;
$uid = user_register($user);
//分配权限
$per_data['uniacid'] = $_W['uniacid'];
$per_data['uid'] = $uid;
$per_data['url'] = 'c=home&a=welcome&do=ext&m=feng_business';
$ret = pdo_insert('users_permission', $per_data);
//分配所属公众号
$acc_data['uniacid'] = $_W['uniacid'];
$acc_data['uid'] = $uid;
$acc_data['role'] = 'operator';
$ret = pdo_insert('uni_account_users', $acc_data);
//保存商户信息
$bus_data['uniacid'] = $_W['uniacid'];
$bus_data['title'] = $data['title'];
$bus_data['bond'] = $data['bond'];
$bus_data['status'] = $data['status'];
$bus_data['createtime'] = time();
$bus_data['uid'] = $uid;
$ret = pdo_insert('eso_sale_busment', $bus_data);
} else {
$bus_data['title'] = $data['title'];
$bus_data['bond'] = $data['bond'];
$bus_data['status'] = $data['status'];
$ret = pdo_update('eso_sale_busment', $bus_data, array('uid' => $uid));
}
if (!empty($ret)) {
message('商户信息保存成功', $this->createWebUrl('busment', array('op' => 'add', 'uid' => $uid)), 'success');
} else {
message('商户信息保存失败');
}
}
include $this->template('busment_add');
} elseif ($op == 'delete') {
$uid = intval($_GPC['uid']);
if (empty($uid)) {
message('未找到指定商户');
}
$result = pdo_delete('users', array('uid' => $uid));
$result = pdo_delete('users_permission', array('uid' => $uid));
$result = pdo_delete('uni_account_users', array('uid' => $uid));
$result = pdo_delete('eso_sale_busment', array('uid' => $uid, 'uniacid' => $_W['uniacid']));
if (intval($result) == 1) {
message('删除商户成功.', $this->createWebUrl('busment'), 'success');
} else {
message('删除商户失败.');
}
}
}
开发者ID:noikiy,项目名称:mygit,代码行数:96,代码来源:site.php
注:本文中的user_register函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论