/** * 用户注册,登录函数 * * @access public * @param string $username * 注册用户名 * @param string $password * 用户密码 * @param string $mobile * 注册mobile * @param array $other * 注册的其他信息 * * @return bool $bool */ function register_by_mobile($username, $password, $mobile, $other = array()) { return _register($username, $password, $mobile, $other, 'mobile'); }
$error_msg = '登录成功'; } else { require_once "../source/class/String.class.php"; $session_id = String::keyGen(); $token = $_POST['token']; $data = $_POST; $data['session_id'] = $session_id; $data['login_count'] = $userinfo['login_count'] + 1; if (!empty($store_id)) { $store = D('Store')->field('uid')->where(array('store_id' => $store_id))->find(); $tmp_user = D('User')->field('app_id')->where(array('uid' => $store['uid']))->find(); $data['app_id'] = !empty($tmp_user['app_id']) ? $tmp_user['app_id'] : 1; } else { $data['app_id'] = !empty($tmp_user['app_id']) ? $tmp_user['app_id'] : 1; } $uid = _register(array('third_id' => trim($_POST['wecha_id']), 'nickname' => trim($data['wechaname']), 'avatar' => trim($data['portrait']), 'phone' => '', 'token' => trim($data['token']), 'session_id' => $data['session_id'], 'reg_time' => time(), 'last_time' => time(), 'reg_ip' => get_client_ip(1), 'login_count' => $data['login_count'], 'app_id' => $data['app_id'])); //注册用户 $wecha_id = trim($_POST['wecha_id']); unset($_POST); $error_code = 0; $error_msg = '登录成功'; } if (empty($store_id)) { $error_code = 1004; $error_msg = '店铺不存在'; $return_url = ''; } else { if (!empty($return_url)) { $return_url = $return_url . '&sessid=' . $session_id . '&token=' . $token . '&wecha_id=' . $wecha_id; } else { $return_url = $config['site_url'] . '/wap/home.php?id=' . $store_id . '&sessid=' . $session_id . '&token=' . $token . '&wecha_id=' . $wecha_id;
$data['tel'] = ''; } if (empty($data['app_id'])) { if (stripos($_POST['login_url'], 'Micrstore') > 0) { //pigcms $data['app_id'] = 1; } else { if (stripos($_POST['login_url'], 'type=weidian') > 0) { //o2o $data['app_id'] = 2; } else { $data['app_id'] = 0; } } } _register(array('nickname' => trim($data['wxname']), 'phone' => trim($data['tel']), 'token' => trim($data['token']), 'source_site_url' => trim($data['site_url']), 'payment_url' => trim($data['payment_url']), 'notify_url' => trim($data['notify_url']), 'oauth_url' => trim($data['login_url']), 'session_id' => trim($data['session_id']), 'reg_time' => time(), 'last_time' => time(), 'reg_ip' => get_client_ip(1), 'login_count' => $data['login_count'], 'is_seller' => 1, 'app_id' => $data['app_id'])); //注册用户 unset($_POST); } $error_code = 0; $error_msg = '登录成功'; //$return_url = $config['site_url'] . '/user.php?c=store&a=select&sessid=' . $session_id . '×tamp=' . time() . '&scope=login'; $return_url = $config['site_url'] . '/user.php?c=store&a=select&sessid=' . $session_id; } } else { $error_code = 1001; $error_msg = '请求失败'; $return_url = ''; } echo json_encode(array('error_code' => $error_code, 'error_msg' => $error_msg, 'return_url' => $return_url)); exit;
$stmt->execute(); if (!empty($username) && !empty($password) && $email !== false) { $sql = "\n INSERT INTO admin_user SET\n username = :username,\n user_pass = :password,\n email = :email\n "; $exec = $pdo->prepare($sql); $exec->bindValue(':username', $username); $exec->bindValue(':password', $password); $exec->bindValue(':email', $email); $exec->execute(); header("Location: login.php"); } } catch (PDOException $e) { echo $e->getMessage(); } } } _register(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Register</title> <link rel="stylesheet" href="../css/admin.css"> </head> <body> <h2 class="title">Register</h2> <div class="form-reg"> <form action="" method="post">