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


PHP user_create函数代码示例

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


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

示例1: newProductBacklog

 function newProductBacklog()
 {
     global $agilemantis_au;
     // Check if team-user name fits into MantisBT regulations
     if (!(utf8_strlen($this->name) < 22 && user_is_name_valid($this->name) && user_is_name_unique($this->name))) {
         return null;
     }
     $p_username = $this->generateTeamUser($this->name);
     $p_email = $this->email;
     $p_email = trim($p_email);
     $t_seed = $p_email . $p_username;
     $t_password = auth_generate_random_password($t_seed);
     if (user_is_name_unique($p_username) === true) {
         user_create($p_username, $t_password, $p_email, 55, false, true, 'Team-User-' . $_POST['pbl_name']);
     } else {
         $t_user_id = $this->getUserIdByName($p_username);
         user_set_field($t_user_id, 'email', $p_email);
     }
     $user_id = $this->getLatestUser();
     $agilemantis_au->setAgileMantisUserRights($user_id, 1, 0, 0);
     if ($this->team == 0) {
         $this->team = $this->getLatestUser();
     }
     $t_sql = "INSERT INTO gadiv_productbacklogs (name, description, user_id) VALUES ( " . db_param(0) . ", " . db_param(1) . ", " . db_param(2) . ") ";
     $t_params = array($this->name, $this->description, $user_id);
     db_query_bound($t_sql, $t_params);
     $this->id = db_insert_id("gadiv_productbacklogs");
     $this->user_id = $user_id;
     return $this->id;
 }
开发者ID:CarlosPinedaT,项目名称:agileMantis,代码行数:30,代码来源:class_product_backlog.php

示例2: auth_attempt_login

function auth_attempt_login($p_username, $p_password, $p_perm_login = false)
{
    $t_user_id = user_get_id_by_name($p_username);
    $t_login_method = config_get('login_method');
    if (false === $t_user_id) {
        if (BASIC_AUTH == $t_login_method) {
            # attempt to create the user if using BASIC_AUTH
            $t_cookie_string = user_create($p_username, $p_password);
            if (false === $t_cookie_string) {
                # it didn't work
                return false;
            }
            # ok, we created the user, get the row again
            $t_user_id = user_get_id_by_name($p_username);
            if (false === $t_user_id) {
                # uh oh, something must be really wrong
                # @@@ trigger an error here?
                return false;
            }
        } else {
            return false;
        }
    }
    # check for disabled account
    if (!user_is_enabled($t_user_id)) {
        return false;
    }
    # max. failed login attempts achieved...
    if (!user_is_login_request_allowed($t_user_id)) {
        return false;
    }
    $t_anon_account = config_get('anonymous_account');
    $t_anon_allowed = config_get('allow_anonymous_login');
    # check for anonymous login
    if (!(ON == $t_anon_allowed && $t_anon_account == $p_username)) {
        # anonymous login didn't work, so check the password
        if (!auth_does_password_match($t_user_id, $p_password)) {
            user_increment_failed_login_count($t_user_id);
            return false;
        }
    }
    # ok, we're good to login now
    # increment login count
    user_increment_login_count($t_user_id);
    user_reset_failed_login_count_to_zero($t_user_id);
    user_reset_lost_password_in_progress_count_to_zero($t_user_id);
    # set the cookies
    auth_set_cookies($t_user_id, $p_perm_login);
    auth_set_tokens($t_user_id);
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:51,代码来源:authentication_api.php

示例3: user_signup

function user_signup($p_username, $p_email)
{
    # Check to see if signup is allowed
    if (OFF == config_get('allow_signup')) {
        return false;
    }
    if (empty($p_username) || empty($p_email)) {
        return false;
    }
    $t_password = create_random_password($p_email);
    if (false === user_create($p_username, $t_password, $p_email)) {
        return false;
    }
    email_signup($p_username, $t_password, $p_email);
    return true;
}
开发者ID:BackupTheBerlios,项目名称:webnotes-svn,代码行数:16,代码来源:user_api.php

示例4: user_initialise

 if (isset($_REQUEST['cmd'])) {
     $cmd = $_REQUEST['cmd'];
 } else {
     $cmd = '';
 }
 /**
  * Main Section
  */
 if ('registration' == $cmd) {
     // get params from the form
     $userData = user_initialise();
     // validate forum params
     $messageList = user_validate_form_registration($userData);
     if (count($messageList) == 0) {
         // Register the new user in the claroline platform
         $userId = user_create($userData);
         set_user_property($userId, 'skype', $userData['skype']);
         if (claro_is_user_authenticated()) {
             // add value in session
             $_user = user_get_properties(claro_get_current_user_id());
             $_user['firstName'] = $_user['firstname'];
             $_user['lastName'] = $_user['lastname'];
             $_user['mail'] = $_user['email'];
             $_user['lastLogin'] = claro_time() - 24 * 60 * 60;
             // DATE_SUB(CURDATE(), INTERVAL 1 DAY)
             $is_allowedCreateCourse = $userData['isCourseCreator'] == 1 ? TRUE : FALSE;
             $_SESSION['_uid'] = claro_get_current_user_id();
             $_SESSION['_user'] = $_user;
             $_SESSION['is_allowedCreateCourse'] = $is_allowedCreateCourse;
             // track user login
             $claroline->notifier->event('user_login', array('data' => array('ip' => $_SERVER['REMOTE_ADDR'])));
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:inscription.php

示例5: switch

include "function.php";
//echo "action: " . $_POST["action"];
//echo var_dump($_POST);
//echo "disp_nme: " . $_POST["disp_nme"];
//echo "email_addr: " . $_POST["email_addr"];
//echo "user_pw: " . $_POST["user_pw"];
//echo "action: " . $_POST["action"];
//echo "user_id_sender: " . $_POST["user_id_sender"];
//echo "user_id_target: " . $_POST["user_id_target"];
//if(isset($_POST["action"])) {
//  echo "POST";
//} else { echo "NOT POST FOR YOU!!!"; }
if (isset($_POST["action"])) {
    switch ($_POST["action"]) {
        case "user_create":
            $value = user_create($_POST["disp_nme"], $_POST["email_addr"], $_POST["user_pw"]);
            break;
        case "contact_create":
            $value = contact_create($_POST["user_id_owner"], $_POST["user_id_member"]);
            break;
        case "message_create":
            $value = message_create($_POST["user_id_sender"], $_POST["user_id_target"]);
            break;
        case "message_upload":
            $value = message_create();
            break;
        case "message_insert":
            $value = message_create($_POST["user_id_sender"], $_POST["user_id_target"]);
            break;
            //case "user_auth":
            //  $value = user_auth($_POST["user_id"], $POST["email_addr"]);
开发者ID:jpkgit,项目名称:mobileweb,代码行数:31,代码来源:server.php

示例6: user_signup

/**
 * Signup a user.
 * If the use_ldap_email config option is on then tries to find email using
 * ldap. $p_email may be empty, but the user wont get any emails.
 * returns false if error, the generated cookie string if ok
 * @param string $p_username The username to sign up.
 * @param string $p_email    The email address of the user signing up.
 * @return string|boolean cookie string or false on error
 */
function user_signup($p_username, $p_email = null)
{
    if (null === $p_email) {
        $p_email = '';
        # @@@ I think the ldap_email stuff is a bit borked
        #  Where is it being set?  When is it being used?
        #  Shouldn't we override an email that is passed in here?
        #  If the user doesn't exist in ldap, is the account created?
        #  If so, there password won't get set anywhere...  (etc)
        #  RJF: I was going to check for the existence of an LDAP email.
        #  however, since we can't create an LDAP account at the moment,
        #  and we don't know the user password in advance, we may not be able
        #  to retrieve it anyway.
        #  I'll re-enable this once a plan has been properly formulated for LDAP
        #  account management and creation.
        #			$t_email = '';
        #			if( ON == config_get( 'use_ldap_email' ) ) {
        #				$t_email = ldap_email_from_username( $p_username );
        #			}
        #			if( !is_blank( $t_email ) ) {
        #				$p_email = $t_email;
        #			}
    }
    $p_email = trim($p_email);
    # Create random password
    $t_password = auth_generate_random_password();
    return user_create($p_username, $t_password, $p_email);
}
开发者ID:pkdevboxy,项目名称:mantisbt,代码行数:37,代码来源:user_api.php

示例7: get_user_id

 function get_user_id()
 {
     $t_user_id = user_get_id_by_name('acra_reporter');
     if ($t_user_id === false) {
         user_create("acra_reporter", date("YzHis", time()), $p_email = 'acra@mantis.com');
     }
     $t_user_id = user_get_id_by_name('acra_reporter');
     return $t_user_id;
 }
开发者ID:since2014,项目名称:MantisAcra,代码行数:9,代码来源:MantisAcra.php

示例8: helper_ensure_confirmed

} else {
    # Password won't to be sent by email. It entered by the admin
    # Now, if the password is empty, confirm that that is what we wanted
    if (is_blank($f_password)) {
        helper_ensure_confirmed(lang_get('empty_password_sure_msg'), lang_get('empty_password_button'));
    }
}
# Don't allow the creation of accounts with access levels higher than that of
# the user creating the account.
access_ensure_global_level($f_access_level);
# Need to send the user creation mail in the tracker language, not in the creating admin's language
# Park the current language name until the user has been created
lang_push(config_get('default_language'));
# create the user
$t_admin_name = user_get_name(auth_get_current_user_id());
$t_cookie = user_create($f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $t_realname, $t_admin_name);
# set language back to user language
lang_pop();
form_security_purge('manage_user_create');
if ($t_cookie === false) {
    $t_redirect_url = 'manage_user_page.php';
} else {
    # ok, we created the user, get the row again
    $t_user_id = user_get_id_by_name($f_username);
    $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $t_user_id;
}
html_page_top(null, $t_redirect_url);
?>

<br />
<div align="center">
开发者ID:Tarendai,项目名称:spring-website,代码行数:31,代码来源:manage_user_create.php

示例9: crud_operations

function crud_operations()
{
    if (session_okay()) {
        if (isset($_POST["user_add"])) {
            user_create();
        }
        if (g("crud") == "d" && !isset($_POST["user_add"])) {
            user_delete();
        }
        if (isset($_POST["user_update"])) {
            user_update();
        }
        if (g("crud") == "u") {
            crud_message_user_update();
        }
    }
}
开发者ID:alicankustemur,项目名称:LoginCrudPHPExample,代码行数:17,代码来源:crud_operations.php

示例10: xmd5

    } else {
        $usermail = @$_POST['usermail'];
        if ($usermail != "") {
            $password = xmd5($_POST['password']);
            if ($session = user_verifypassword($scope, $usermail, $password)) {
                $newsession = user_updatesession($scope, $usermail, $session);
                //setcookie("auth",$usermail."||".$newsession,time()+60*60*24*30,"/");
                header("Location:{$dest}?op=session&usermail={$usermail}&session={$newsession}");
            }
        }
        echo "\n\t\t\t<div style='position:absolute;\n\t\t\t\t\t\ttop:50%;left:50%;\n\t\t\t\t\t\tborder:1px solid #000000;\n\t\t\t\t\t\tpadding:25px;\n\t\t\t\t\t\twidth:400px;height:250px;\n\t\t\t\t\t\tmargin-left:-200px;\n\t\t\t\t\t\tmargin-top: -125px;'>\n\t\t\t<h2>Login</h2><hr><br>\n\t\t\t<form action='index.php?op=login&scope={$scope}&dest={$dest}' method='post'>\n\t\t\tusermail <input type='text' name='usermail'><br><br>\n\t\t\tpassword<input type='password' name='password'><br><br>\n\t\t\t<input type='submit' style='button blue' value='login'>\n\t\t\t<a href='index.php?op=registration&scope={$scope}&dest={$dest}'>registra</a>\n\t\t\t</form>\n\t\t\t</div>\n\t\t\t";
    }
}
if ($op == 'logout') {
    //setcookie("auth",null, time()-3600,"/");
    header("Location:{$dest}?op=logout");
}
if ($op == 'create') {
    $usermail = $_POST['usermail'];
    $password = xmd5($_POST['password']);
    if (user_search($scope, $usermail) == false) {
        $newsession = user_create($scope, $usermail, $password);
        //setcookie("auth",$usermail."||".$newsession,time()+60*60*24*30,"/");
        header("Location:{$dest}?op=session&usermail={$usermail}&session={$newsession}");
    } else {
        $op = 'registration';
    }
}
if ($op == 'registration') {
    echo "\n\t<div style='position:absolute;\n\t\t\t\t\t\ttop:50%;left:50%;\n\t\t\t\t\t\tborder:1px solid #000000;\n\t\t\t\t\t\tpadding:25px;\n\t\t\t\t\t\twidth:450px;height:250px;\n\t\t\t\t\t\tmargin-left:-225px;\n\t\t\t\t\t\tmargin-top: -125px;'>\n\t<h2>registration</h2><hr><br>\n\t<form action='index.php?op=create&scope={$scope}&dest={$dest}' method='post'>\n\tusermail <input type='text' name='usermail'><br><br>\n\tpassword<input type='password' name='password'> retype<input type='password' name='repassword'><br><br>\n\t<input type='submit' value='register' onclick=\"if (password.value!=repassword.value){ alert('le 2 password non coincidono');return false;}return true;\" >\n\t</form></div>";
}
开发者ID:verticaldev-altervista,项目名称:minimo-php,代码行数:31,代码来源:index.php

示例11: change_role

    echo change_role($login, $val);
    exit;
} elseif (isset($_GET['a']) && $_GET['a'] == 'deluid') {
    if (empty($_GET['uid']) || !($login = trim($_GET['uid']))) {
        return;
    }
    strenc_todb($val);
    user_delete($login);
    header('Location: users.php');
    exit;
} elseif (isset($_GET['a']) && $_GET['a'] == 'newuid') {
    if (empty($_GET['val']) || !($login = trim($_GET['val']))) {
        return;
    }
    strenc_todb($val);
    user_create($login);
    header('Location: users.php');
    exit;
} elseif (isset($_GET['a']) && $_GET['a'] == 'newpwd') {
    if (empty($_GET['uid']) || !($login = trim($_GET['uid']))) {
        return;
    }
    if (empty($_GET['val']) || !($pwd = trim($_GET['val']))) {
        return;
    }
    strenc_todb($val);
    change_pwd($login, $pwd);
    header('Location: users.php');
    exit;
}
include_once 'mainpage.php';
开发者ID:zcsevcik,项目名称:edu,代码行数:31,代码来源:users.php

示例12: define

<?php

define('APP_NAME', 'test');
chdir(getcwd() . '/../');
include './XiunoPHP.3.0.php';
include './model.inc.php';
$forumlist = forum_list_cache();
$grouplist = group_list_cache();
$user = user_token_get('', 'bbs');
// 全局的 user,全局变量除了 $conf, 其他全部加下划线
$uid = $user['uid'];
// 全局的 uid
$gid = $user['gid'];
// 全局的 gid
$header['title'] = $conf['sitename'];
// 网站标题
$header['keywords'] = $conf['sitename'];
// 关键词
$header['description'] = $conf['sitename'];
// 描述
// 启动在线,将清理函数注册,不能写日志。
runtime_init();
online_init();
register_shutdown_function('online_save');
register_shutdown_function('runtime_save');
user_create($arr);
// 资源清理,删除用户:
function x($info, $a, $b)
{
    echo "{$info}: ... " . ($a === $b ? 'true' : 'false' . ", " . var_export($a, 1) . ", " . var_export($b, 1)) . "\r\n";
}
开发者ID:xiuno,项目名称:xiunobbs,代码行数:31,代码来源:test_user_create.php

示例13: post

 public function post($request)
 {
     /**
      * 	Creates a new user.
      *
      * 	The user will get a confirmation email, and will have the password provided
      * 	in the incoming representation.
      *
      * 	@param $request - The Request we're responding to
      */
     if (!access_has_global_level(config_get('manage_user_threshold'))) {
         throw new HTTPException(403, "Access denied to create user");
     }
     $new_user = new User();
     $new_user->populate_from_repr($request->body);
     $username = $new_user->mantis_data['username'];
     $password = $new_user->mantis_data['password'];
     $email = email_append_domain($new_user->mantis_data['email']);
     $access_level = $new_user->mantis_data['access_level'];
     $protected = $new_user->mantis_data['protected'];
     $enabled = $new_user->mantis_data['enabled'];
     $realname = $new_user->mantis_data['realname'];
     if (!user_is_name_valid($username)) {
         throw new HTTPException(500, "Invalid username");
     } elseif (!user_is_realname_valid($realname)) {
         throw new HTTPException(500, "Invalid realname");
     }
     user_create($username, $password, $email, $access_level, $protected, $enabled, $realname);
     $new_user_id = user_get_id_by_name($username);
     $new_user_url = User::get_url_from_mantis_id($new_user_id);
     $this->rsrc_data = $new_user_url;
     $resp = new Response();
     $resp->status = 201;
     $resp->headers[] = "location: {$new_user_url}";
     $resp->body = $this->_repr($request);
     return $resp;
 }
开发者ID:NetWielder,项目名称:mantis-rest,代码行数:37,代码来源:userlist.class.php

示例14: addslashes

/**
 * make sure ajax script was loaded and user is
 * logged in 
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    die;
}
// load users functions
require HOME . '_inc/function/users.php';
$name = addslashes(@$_POST['name']);
$email = addslashes(@$_POST['email']);
$password = @$_POST['password'];
$repeat = @$_POST['repeat'];
$groups = explode(',', addslashes(@$_POST['groups']));
/**
 * validate post info 
 */
if (empty($name) || empty($email) || empty($password) || empty($groups)) {
    die('error');
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    die('error');
}
if ($password != $repeat) {
    die('error');
}
$id = user_create($name, $email, $password, $groups);
if (!$id) {
    die('error');
}
die(print $id);
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:31,代码来源:new-user.php

示例15: date

 $pdtArray['period'] = '1ヶ月';
 $pdtArray['unittype'] = 2;
 $now = date("Y-m-d");
 $pdtArray['start_date'] = $now;
 $pdtArray['end_date'] = date("Y-m-d", strtotime("+" . $month . " month"));
 $tx_token = 'test12';
 //-------------------------- test ---------------------------------------
 //serial_check
 $result = serial_check($tx_token, $pdtArray);
 if (strcmp($result->{'success'}, "true") != 0) {
     $logger->debug("取引ID番号の検証が失敗しました。<br>");
     LoggerManager::shutdown();
     header("Location: message.php?message=取引ID番号の検証が失敗しました。<br>エラーメッセージ:" . $result->{'msg'});
 } else {
     //user_create
     $result = user_create($pdtArray);
     if (strcmp($result->{'success'}, "true") != 0) {
         $logger->debug("ユーザの作成が失敗しました。<br>");
         LoggerManager::shutdown();
         header("Location: message.php?message=ユーザの作成が失敗しました。<br>エラーメッセージ:" . $result->{'msg'});
     } else {
         $pdtArray['password'] = $result->{'data'}[0];
         //userstatus_create
         $result = userstatus_create($pdtArray);
         if (strcmp($result->{'success'}, "true") != 0) {
             $logger->debug("料金プランの作成が失敗しました。<br>");
             LoggerManager::shutdown();
             header("Location: message.php?message=料金プランの作成が失敗しました。<br>エラーメッセージ:" . $result->{'msg'});
         } else {
             //serial_update
             $result = serial_update($tx_token);
开发者ID:oizhaolei,项目名称:websysadmin,代码行数:31,代码来源:order_result.php


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