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


PHP UserDB::addUser方法代码示例

本文整理汇总了PHP中UserDB::addUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::addUser方法的具体用法?PHP UserDB::addUser怎么用?PHP UserDB::addUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserDB的用法示例。


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

示例1: getenv

 function Security_htaccesslogin($DB = "")
 {
     $this->DB = $DB;
     # BEGIN LOGIN
     $id = getenv('REMOTE_USER');
     if ($id != "") {
         $userdb = new UserDB($DB);
         $user = new WikiUser();
         # get from COOKIE VARS
         if ($userdb->_exists($id)) {
             # login
             $user = $userdb->getUser($id);
             $options['id'] = $user->id;
             $options['login_id'] = $user->id;
             $dummy = $user->setCookie();
             $dummy = $userdb->saveUser($user);
         } else {
             # create account
             $user->id = $id;
             $options['id'] = $user->id;
             #$ticket=md5(time().$user->id.$options['email']);
             #$user->info['eticket']='';
             $dummy = $user->setCookie();
             $dummy = $userdb->addUser($user);
         }
     }
     # END LOGIN
 }
开发者ID:ahastudio,项目名称:moniwiki,代码行数:28,代码来源:htaccesslogin.php

示例2: UserDB

<?php

/*
================================================================================
    REQUEST OF ADD USERS
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../UserDB.php";
$user = $_POST['name'];
$password = $_POST['password'];
$email = $_POST['email'];
$state = $_POST['state'];
//Instance
$Conection = new UserDB("WebProject", "localhost", "root", " ");
$data = $Conection->addUser($user, $password, $email, $state);
开发者ID:ea2305,项目名称:SimulatorFedoraWeb,代码行数:18,代码来源:addUsers.php

示例3: post

 public static function post()
 {
     $page = new Page();
     $page->data['title'] = 'Gebruiker toevoegen';
     //Validate input
     $formTopViewErrMsgs = UserDataFormTopViewValidator::validate($_POST);
     $formPasswordViewErrMsgs = UserDataFormPasswordViewValidator::validate($_POST);
     $formMiddleViewErrMsgs = UserDataFormMiddleViewValidator::validate($_POST);
     //No error means we create a user and password salt
     if (empty($formTopViewErrMsgs) && empty($formPasswordViewErrMsgs) && empty($formMiddleViewErrMsgs)) {
         $passwordSalt = Random::getGuid();
         $user = new User();
         $user->email = $_POST['email'];
         $user->firstName = ucwords($_POST['first_name']);
         $user->lastName = ucwords($_POST['last_name']);
         $user->passwordHash = hash_pbkdf2("sha256", $_POST['password'], $passwordSalt, SecurityConfig::N_PASSWORD_HASH_ITERATIONS);
         $user->street = ucwords($_POST['street']);
         $user->houseNumber = $_POST['house_number'];
         $user->city = ucwords($_POST['city']);
         $user->postalCode = $_POST['postal_code'];
         $user->country = ucwords($_POST['country']);
         $user->phone = $_POST['phone'];
         $user->dateOfBirth = $_POST['date_of_birth'];
         //Add the user
         try {
             $userId = UserDB::addUser($user, $passwordSalt, $_POST['card_number']);
             $page->addView('addRenewUser/addUser/SuccessfullyAddedView');
             //Send welcome mail
             try {
                 $failedEmails = Email::sendEmails('WelcomeNewMember.html', 'JH DE Stip - Welkom', EmailConfig::FROM_ADDRESS, [$user], null);
                 //If failedEmails is not empty the mail was not sent
                 if (!empty($failedEmails)) {
                     $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan welkomstmail niet verzenden.';
                     $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
                 }
             } catch (Exception $ex) {
                 $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan welkomstmail niet verzenden.';
                 $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
             }
             //Add money to user's card
             try {
                 $addedUser = UserDB::getFullUserById($userId);
                 $executingBrowserName = BrowserDB::getBrowserById($_SESSION['Stippers']['browser']->browserId)->name;
                 $trans = new MoneyTransaction(null, $addedUser->userId, 0, AddOrRenewUserConfig::NEW_OR_RENEWED_USER_BONUS, 0, 0, true, null, $executingBrowserName, null);
                 MoneyTransactionDB::addTransaction($addedUser, $trans);
             } catch (Exception $ex) {
                 if (isset($page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'])) {
                     $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] .= ' Kan het saldo van het account niet verhogen, probeer dit handmatig te doen.';
                 } else {
                     $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan het saldo van het account niet verhogen, probeer dit handmatig te doen.';
                 }
                 $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
             }
         } catch (UserDBException $ex) {
             AddUserController::buildAddUserPage($page, true);
             if ($ex->getCode() == UserDBException::EMAILALREADYEXISTS) {
                 $page->data['UserDataFormTopView']['errMsgs']['global'] = '<h2 class="error_message" id="user_data_form_error_message">Dit e-mailadres is al in gebruik.</h2>';
             } elseif ($ex->getCode() == UserDBException::CARDALREADYUSED) {
                 $page->data['UserDataFormTopView']['errMsgs']['global'] = '<h2 class="error_message" id="user_data_form_error_message">Dit kaartnummer is al in gebruik.</h2>';
             } else {
                 $page->data['UserDataFormTopView']['errMsgs']['global'] = '<h2 class="error_message" id="user_data_form_error_message">Kan gebruiker niet toevoegen, probeer het opnieuw.</h2>';
             }
         } catch (Exception $ex) {
             AddUserController::buildAddUserPage($page, true);
             $page->data['UserDataFormTopView']['errMsgs']['global'] = '<h2 class="error_message" id="user_data_form_error_message">Kan gebruiker niet toevoegen, probeer het opnieuw.</h2>';
         }
     } else {
         AddUserController::buildAddUserPage($page, true);
         $page->data['UserDataFormTopView']['errMsgs'] = array_merge($page->data['UserDataFormTopView']['errMsgs'], $formTopViewErrMsgs);
         $page->data['UserDataFormPasswordView']['errMsgs'] = array_merge($page->data['UserDataFormPasswordView']['errMsgs'], $formPasswordViewErrMsgs);
         $page->data['UserDataFormMiddleView']['errMsgs'] = array_merge($page->data['UserDataFormMiddleView']['errMsgs'], $formMiddleViewErrMsgs);
     }
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:74,代码来源:AddUserController.php


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