本文整理汇总了PHP中create_account函数的典型用法代码示例。如果您正苦于以下问题:PHP create_account函数的具体用法?PHP create_account怎么用?PHP create_account使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_account函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register($member_group_id = 2, $username = null, $password = null, $email = null, $mobile = null)
{
if (IS_POST) {
$data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'account' => create_account(), 'create_time' => NOW_TIME, 'update_time' => NOW_TIME);
//验证手机
//if(empty($data['mobile'])) unset($data['mobile']);
$user = D('Member');
/* 添加用户 */
if ($user->create($data)) {
$user->password = ainiku_ucenter_md5($user->password);
$user->member_group_id = $member_group_id;
$result = $user->add();
//return $this->$uid ? '注册成功' : '注册失败'; //0-未知错误,大于0-注册成功
if (0 < $result) {
$this->success('注册成功', U('login'));
} else {
$this->error('注册失败');
}
} else {
return $this->error($user->getError());
}
} else {
if (IS_AJAX) {
$this->display('ajaxregister');
} else {
$this->display();
}
}
}
示例2: ldapauth_hook_authenticate
function ldapauth_hook_authenticate($a, &$b)
{
$mail = '';
if (ldapauth_authenticate($b['username'], $b['password'], $mail)) {
$results = q("SELECT * FROM account where account_email = '%s' OR account_email = '%s' AND account_flags in (0,1) limit 1", dbesc($b['username']), dbesc($mail));
if (!$results && $mail && intval(get_config('ldapauth', 'create_account')) == 1) {
require_once 'include/account.php';
$acct = create_account(array('email' => $mail, 'password' => random_string()));
if ($acct['success']) {
logger('ldapauth: Created account for ' . $b['username'] . ' using ' . $mail);
info(t('An account has been created for you.'));
$b['user_record'] = $acct['account'];
$b['authenticated'] = 1;
}
} elseif (intval(get_config('ldapauth', 'create_account')) != 1 && !$results) {
logger('ldapauth: User ' . $b['username'] . ' authenticated but no db-record and. Rejecting auth.');
notice(t('Authentication successful but rejected: account creation is disabled.'));
return;
}
if ($results) {
logger('ldapauth: Login success for ' . $b['username']);
$b['user_record'] = $results[0];
$b['authenticated'] = 1;
}
}
return;
}
示例3: QQregister
public function QQregister($openid)
{
$qqinfo = session('qqinfo');
$data['openid'] = $openid;
$data['member_group_id'] = 2;
//$data['account'] = create_account();
$data['nickname'] = $qqinfo['nickname'];
$mem = M('Member');
$re = $mem->where("openid='{$openid}'")->find();
if (!empty($re)) {
$data['member_id'] = $re['member_id'];
if ($mem->create($data)) {
//保存或更新qq的信息到数据库
$mem->save();
}
//已经是登陆用户
return $re['member_id'];
} else {
/* 添加用户 */
$data['last_login_ip'] = get_client_ip();
$data['account'] = create_account();
$data['username'] = $data['account'];
//生成用户名
$uid = $mem->add($data);
return $uid ? $uid : 0;
//0-未知错误,大于0-注册成功
}
}
示例4: add
public function add($member_group_id = '', $username = '', $password = '', $repassword = '', $email = '')
{
if (IS_POST) {
/* 检测密码 */
if ($password != $repassword) {
$this->error('密码和重复密码不一致!');
}
$data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'account' => create_account());
//自动判断用户名是哪个字段
$data[get_account_type($username)] = $username;
$mem = D('Member');
/* 添加用户 */
if ($mem->create($data)) {
$mem->password = ainiku_ucenter_md5($mem->password);
$uid = $mem->add();
return $uid > 0 ? $this->success('添加成功') : $this->error('添加失败');
//0-未知错误,大于0-注册成功
} else {
return $this->error($mem->getError());
//错误详情见自动验证注释
}
} else {
$field = get_model_attr('member');
$this->assign('fieldarr', $field);
$this->meta_title = '新增用户';
$this->display('edit');
}
}
示例5: register
/**
/**
* 注册一个新用户
* @param string $username 用户名
* @param string $password 用户密码
* @param string $email 用户邮箱
* @param string $mobile 用户手机号码
* @return integer 注册成功-用户信息,注册失败-错误编号
*/
public function register($member_group_id, $username, $password, $email, $mobile)
{
$data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'account' => create_account());
//验证手机
if (empty($data['mobile'])) {
unset($data['mobile']);
}
/* 添加用户 */
if ($this->create($data)) {
$this->data['password'] = ainiku_ucenter_md5($this->data['password']);
$uid = $this->add();
return $uid ? $uid : 0;
//0-未知错误,大于0-注册成功
} else {
return $this->getError();
//错误详情见自动验证注释
}
}
示例6: main
function main()
{
if (!empty($_POST["type"]) && !empty($_POST["email"]) && !empty($_POST["password"])) {
$email = $_POST["email"];
$password = $_POST["password"];
$type = $_POST["type"];
if ($type == "create" && !empty($_POST["username"])) {
$username = $_POST["username"];
create_account($email, $password, $username);
} else {
if ($type == "login") {
login($email, $password);
} else {
redirect("index", "Oops! Post information wasn't passed.");
}
}
}
}
示例7: check_account_exists
function check_account_exists()
{
$username = strtolower(trim($_POST['username']));
$command = "show account {$username}\r\n";
$sock = fsockopen("127.0.0.1", 9996, $errornumber, $errorstring, 30);
if (!$sock) {
die("Error {$errornumber}: {$errorstring}");
}
fputs($sock, $command);
sleep(1);
$result = fread($sock, 1000);
fclose($sock);
if (strpos($result, "Cannot find account")) {
create_account();
} else {
echo "<B><font color=red>That account name is taken, please try again.</font></B><BR>";
display_form();
}
}
示例8: array
* success or error page if the form has been submitted.
*/
require_once 'panel-config.php';
require_once 'lib/utility.php';
// Render the account form if all required fields were not filled out
if (!was_submitted('create_account') || !isset($_POST['netid']) || !isset($_POST['password']) || !isset($_POST['aup']) || $_POST['aup'] != 'yes') {
$errors = array();
// Give error messages if the form was submitted
if (was_submitted('create_account')) {
if (!isset($_POST['netid']) || trim($_POST['netid']) == '') {
$errors[] = "Please enter your NetID.";
}
if (!isset($_POST['password']) || trim($_POST['password']) == '') {
$errors[] = "Please enter your NetID password.";
}
if (!isset($_POST['aup']) || $_POST['aup'] != 'yes') {
$errors[] = "You need to read and accept our Acceptable Use Policy.";
}
}
echo $twig->render('join.html', array('form_fields' => array('netid' => isset($_POST['netid']) ? $_POST['netid'] : '', 'lcc' => isset($_POST['lcc']) ? $_POST['lcc'] : '', 'aup' => isset($_POST['aup']) && $_POST['aup'] == 'yes'), 'error_messages' => $errors, 'show_subfooter' => false));
} else {
require_once 'lib/create-account.php';
$result = create_account($_POST['netid'], $_POST['password'], $_POST['lcc']);
if ($result['status'] == STATUS_AUTH_ERROR) {
// Password or NetID were incorrect, render the creation form again
echo $twig->render('join.html', array('form_fields' => array('netid' => $_POST['netid'], 'lcc' => $_POST['lcc'], 'aup' => true), 'error_messages' => array($result['message']), 'show_subfooter' => false));
} else {
// Render the account creation result
echo $twig->render('account-created.html', array('status' => $result['status'], 'message' => $result['message'], 'info' => isset($result['info']) ? $result['info'] : null, 'show_subfooter' => $result['status'] == STATUS_OK));
}
}
示例9: get_database_connections
}
// == Check DB connections first! == //
$connect = get_database_connections(false);
$DB = $connect['plexis'];
$Realm = $connect['realm'];
// == Include emulator file == //
include ROOT . DS . 'emulators' . DS . $_POST['emulator'] . '.php';
// Fetch posted account name
$account = fetch_account($_POST['account']);
if ($account != FALSE) {
$array = array('id' => $account['id'], 'username' => $account['username'], 'email' => $account['email'], 'registration_ip' => $_SERVER['REMOTE_ADDR'], 'activated' => 1, 'group_id' => 4);
$mode = 1;
$success = $DB->insert('pcms_accounts', $array, true) != false ? true : false;
} else {
// No such account, creating one, in this case pwd is needed, so checking whether it's provided...
$result = create_account($_POST['account'], $_POST['pass']);
if ($result != FALSE) {
// Get the account ID
$accountid = $Realm->last_insert_id();
// Connect to the Plexis DB
$ac = array('id' => $accountid, 'username' => $_POST['account'], 'activated' => 1, 'registration_ip' => $_SERVER['REMOTE_ADDR'], 'group_id' => 4);
$success = $DB->insert('pcms_accounts', $ac, true) != false ? true : false;
$mode = 2;
} else {
$success = false;
$mode = 0;
}
}
// Lock the installer on success
if ($success == true || $mode > 0) {
$file = fopen("install.lock", "w+");
示例10: register_post
function register_post(&$a)
{
$max_dailies = intval(get_config('system', 'max_daily_registrations'));
if ($max_dailies) {
$r = q("select count(account_id) as total from account where account_created > UTC_TIMESTAMP() - INTERVAL 1 day");
if ($r && $r[0]['total'] >= $max_dailies) {
notice(t('Maximum daily site registrations exceeded. Please try again tomorrow.') . EOL);
return;
}
}
if (!x($_POST, 'tos')) {
notice(t('Please indicate acceptance of the Terms of Service. Registration failed.') . EOL);
return;
}
$policy = get_config('system', 'register_policy');
$email_verify = get_config('system', 'verify_email');
switch ($policy) {
case REGISTER_OPEN:
$flags = ACCOUNT_OK;
break;
case REGISTER_APPROVE:
$flags = ACCOUNT_BLOCKED | ACCOUNT_PENDING;
break;
default:
case REGISTER_CLOSED:
if (!is_site_admin()) {
notice(t('Permission denied.') . EOL);
return;
}
$flags = ACCOUNT_BLOCKED;
break;
}
if ($email_verify && $policy == REGISTER_OPEN) {
$flags = $flags | ACCOUNT_UNVERIFIED;
}
if (!$_POST['password'] || $_POST['password'] !== $_POST['password2']) {
notice(t('Passwords do not match.') . EOL);
return;
}
$arr = $_POST;
$arr['account_flags'] = $flags;
$result = create_account($arr);
if (!$result['success']) {
notice($result['message']);
return;
}
require_once 'include/security.php';
$using_invites = intval(get_config('system', 'invitation_only'));
$num_invites = intval(get_config('system', 'number_invites'));
$invite_code = x($_POST, 'invite_code') ? notags(trim($_POST['invite_code'])) : '';
if ($using_invites && $invite_code) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_code));
set_pconfig($result['account']['account_id'], 'system', 'invites_remaining', $num_invites);
}
if ($policy == REGISTER_OPEN) {
if ($email_verify) {
$res = verify_email_address($result);
} else {
$res = send_verification_email($result['email'], $result['password']);
}
if ($res) {
info(t('Registration successful. Please check your email for validation instructions.') . EOL);
}
} elseif ($policy == REGISTER_APPROVE) {
$res = send_reg_approval_email($result);
if ($res) {
info(t('Your registration is pending approval by the site owner.') . EOL);
} else {
notice(t('Your registration can not be processed.') . EOL);
}
goaway(z_root());
}
if ($email_verify) {
goaway(z_root());
}
authenticate_success($result['account'], true, false, true);
if (!strlen($next_page = get_config('system', 'workflow_register_next'))) {
$next_page = 'new_channel';
}
$_SESSION['workflow'] = true;
goaway(z_root() . '/' . $next_page);
}
示例11: createCustomerAccount
function createCustomerAccount()
{
global $currencies, $customer_id, $onepage, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id, $languages_id, $sendto, $billto, $user, $auth, $cart, $customer_id, $_SERVER, $messageStack;
$this->checkCartValidity();
if ($onepage['createAccount'] === true && $this->checkEmailAddress($onepage['customer']['email_address'])) {
require_once 'includes/functions/account.php';
$data = array('firstname' => $onepage['billing']['firstname'], 'lastname' => $onepage['billing']['lastname'], 'email_address' => $onepage['customer']['email_address'], 'telephone' => $onepage['customer']['telephone'], 'fax' => $onepage['customer']['fax'], 'password' => $onepage['customer']['password'], 'confirmation' => $onepage['customer']['password'], 'street_address' => $onepage['billing']['street_address'], 'postcode' => $onepage['billing']['postcode'], 'city' => $onepage['billing']['city'], 'country' => $onepage['billing']['country_id'], 'forum_username' => '', 'TermsAgree' => '1');
if (ACCOUNT_GENDER == 'true') {
$data['gender'] = $onepage['billing']['gender'];
}
if (ACCOUNT_DOB == 'true') {
$data['dob'] = tep_date_raw($onepage['customer']['dob']);
}
if (ACCOUNT_COMPANY == 'true') {
$data['company'] = $onepage['billing']['company'];
}
if (ACCOUNT_COMPANY == 'true') {
$data['btwnr'] = $onepage['billing']['btwnr'];
}
if (ACCOUNT_SUBURB == 'true') {
$data['entry_suburb'] = $onepage['billing']['suburb'];
}
if (ACCOUNT_STATE == 'true') {
$state = $onepage['billing']['state'];
$zone_name = '';
$zone_id = 0;
$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "'");
$check = tep_db_fetch_array($check_query);
$entry_state_has_zones = $check['total'] > 0;
if ($entry_state_has_zones == true) {
$zone_query = tep_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
if (tep_db_num_rows($zone_query) == 1) {
$zone = tep_db_fetch_array($zone_query);
$zone_id = $zone['zone_id'];
$zone_name = $zone['zone_name'];
}
}
if ($zone_id > 0) {
$data['zone_id'] = $zone_id;
$data['state'] = '';
} else {
$data['zone_id'] = '0';
$data['state'] = $state;
}
}
if (count($onepage['customer']['newsletters']) > 0) {
foreach ($onepage['customer']['newsletters'] as $newsletter) {
$data['newsletters_' . $newsletter] = '1';
}
}
create_account($data);
if (isset($_POST['diffShipping'])) {
$sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $onepage['delivery']['firstname'], 'entry_lastname' => $onepage['delivery']['lastname'], 'entry_street_address' => $onepage['delivery']['street_address'], 'entry_postcode' => $onepage['delivery']['postcode'], 'entry_city' => $onepage['delivery']['city'], 'entry_country_id' => $onepage['delivery']['country_id']);
if (ACCOUNT_GENDER == 'true') {
$sql_data_array['entry_gender'] = $onepage['delivery']['gender'];
}
if (ACCOUNT_COMPANY == 'true') {
$sql_data_array['entry_company'] = $onepage['delivery']['company'];
}
if (ACCOUNT_SUBURB == 'true') {
$sql_data_array['entry_suburb'] = $onepage['delivery']['suburb'];
}
if (ACCOUNT_STATE == 'true') {
$state = $onepage['delivery']['state'];
$zone_name = '';
$zone_id = 0;
$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "'");
$check = tep_db_fetch_array($check_query);
$entry_state_has_zones = $check['total'] > 0;
if ($entry_state_has_zones == true) {
$zone_query = tep_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
if (tep_db_num_rows($zone_query) == 1) {
$zone = tep_db_fetch_array($zone_query);
$zone_id = $zone['zone_id'];
$zone_name = $zone['zone_name'];
}
}
if ($zone_id > 0) {
$sql_data_array['entry_zone_id'] = $zone_id;
$sql_data_array['entry_state'] = '';
} else {
$sql_data_array['entry_zone_id'] = '0';
$sql_data_array['entry_state'] = $state;
}
}
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
}
if (isset($onepage['info']['order_id'])) {
tep_db_query('update ' . TABLE_ORDERS . ' set customers_id = "' . $customer_id . '" where orders_id = "' . $onepage['info']['order_id'] . '"');
unset($onepage['info']['order_id']);
}
if (!tep_session_is_registered('customer_id')) {
tep_session_register('customer_id');
}
if (!tep_session_is_registered('sendto')) {
tep_session_register('sendto');
}
if (!tep_session_is_registered('billto')) {
tep_session_register('billto');
}
//.........这里部分代码省略.........
示例12: create_account
<?php
$title = 'Create new account';
require 'inc_header.php';
?>
<?php
$attempted_account_creation = false;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$attempted_account_creation = true;
$account_creation_error = create_account();
}
?>
<?php
if ($attempted_account_creation) {
?>
<div class="span8 offset2">
<?php
if (isset($account_creation_error)) {
?>
<h2>Account creation error</h2>
<p><?php
echo $account_creation_error;
?>
</p>
<p><a href="<?php
echo BASE_URL;
?>
create-account.php">Return to account creation page</a></p>
示例13: create_account_and_ninja
function create_account_and_ninja($send_name, $params = array())
{
$send_email = $params['send_email'];
$send_pass = $params['send_pass'];
$class_identity = $params['send_class'];
$confirm = (int) $params['confirm'];
$error = false;
$data['ip'] = isset($params['ip']) ? $params['ip'] : null;
$ninja_id = create_ninja($send_name, $params);
$account_id = create_account($ninja_id, $send_email, $send_pass, $confirm, $type = 0, $active = 1, $data);
if ($account_id) {
$sent = send_signup_email($account_id, $send_email, $send_name, $confirm, $class_identity);
if (!$sent && !DEBUG) {
$error = 'There was a problem sending your signup to that email address.';
}
}
return $error;
}
示例14: start_order_transaction
function start_order_transaction($mid, $amount)
{
// Ensure 'order' account
if (get_balance("ORD", $mid, null) == 'NO_ACCOUNT') {
if (!create_account("ORD", $mid, null, $mid, ip2long(getRealIpAddr()), null, null, '')) {
return FALSE;
}
}
$date = time();
$temp = mt_rand() + 1;
$res = create_temp_transaction($temp, array(k_transaction_party("ORD", $mid, 1, $amount, $temp, $date, null), k_transaction_party("USR", $mid, 1, -$amount, $temp, $date, null)), ip2long(getRealIpAddr()), $date, '');
if ($res < 1) {
return FALSE;
}
$res = lock_transaction($temp);
return $res == "2" ? $temp : FALSE;
}
示例15: die
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REST/OAuth Example</title>
</head>
<body>
<tt>
<?php
$access_token = $_SESSION['access_token'];
$instance_url = $_SESSION['instance_url'];
if (!isset($access_token) || $access_token == "") {
die("Error - access token missing from session!");
}
if (!isset($instance_url) || $instance_url == "") {
die("Error - instance URL missing from session!");
}
show_accounts($instance_url, $access_token);
$id = create_account("My New Org", $instance_url, $access_token);
show_account($id, $instance_url, $access_token);
show_accounts($instance_url, $access_token);
update_account($id, "My New Org, Inc", "San Francisco", $instance_url, $access_token);
show_account($id, $instance_url, $access_token);
show_accounts($instance_url, $access_token);
delete_account($id, $instance_url, $access_token);
show_accounts($instance_url, $access_token);
?>
</tt>
</body>
</html>