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


PHP User::createUser方法代码示例

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


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

示例1: actionRegister

 public function actionRegister()
 {
     $model = new User('register');
     $provinces = Province::model()->findAll();
     $provinces = CHtml::listData($provinces, 'idProvince', 'name');
     $cities = array();
     $districts = array();
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->createUser()) {
             //Log in the new user
             $modelLoginForm = new LoginForm();
             $modelLoginForm->username = $model->username;
             $modelLoginForm->password = $model->conf_password;
             //because password has been md5
             if ($modelLoginForm->login()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         if (isset($model->idProvince)) {
             $cities = City::model()->findAllByAttributes(array('idProvince' => $model->idProvince));
             $cities = CHtml::listData($cities, 'idCity', 'name');
         }
         if (isset($model->idCity)) {
             $districts = District::model()->findAllByAttributes(array('idCity' => $model->idCity));
             $districts = CHtml::listData($districts, 'idDistrict', 'name');
         }
     }
     $this->render('register', array('model' => $model, 'provinces' => $provinces, 'cities' => $cities, 'districts' => $districts));
 }
开发者ID:rikohz,项目名称:Project1,代码行数:30,代码来源:UserController.php

示例2: run

 public function run()
 {
     try {
         foreach ($this->groups as $g) {
             User::createGroup($g);
         }
         // Add super user
         $super = ['email' => 'superadmin@email.com', 'password' => 'password', 'first_name' => 'Fordyce', 'last_name' => 'Gozali', 'slug' => 'fordyce-gozali', 'activated' => true];
         $group = User::findGroupByName('Super User');
         if ($group) {
             $user = User::createUser($super);
             $user->addGroup($group);
         }
         //Add admins
         $admins = [['email' => 'admin@email.com', 'password' => 'password', 'first_name' => 'Admin', 'last_name' => '', 'slug' => 'admin', 'activated' => true]];
         $group = User::findGroupByName('Admin');
         if ($group) {
             foreach ($admins as $a) {
                 $user = User::createUser($a);
                 $user->addGroup($group);
             }
         }
     } catch (\Exception $e) {
         return $this->command->info($e->getMessage());
     }
 }
开发者ID:phantomlight,项目名称:programme-chameleon,代码行数:26,代码来源:UserSeeder.php

示例3: acceptRequest

 public static function acceptRequest($req_id, $admin = false)
 {
     DB::updateRequestAccepted($req_id);
     $req = self::getRequest($req_id);
     $pass = User::createUser(array('email' => $req['email'], 'login' => $req['login'], 'admin' => $admin ? 1 : 0, 'request_id' => $req_id));
     sendMessage($req['email'], "Ваша заявка одобрена. Пароль: {$pass}");
 }
开发者ID:7parts-evo,项目名称:main-evo,代码行数:7,代码来源:request.php

示例4: register

 public function register()
 {
     $this->db->begin();
     $modelUser = new User();
     $res = $modelUser->createUser($this->request->getPost());
     if (false == $res) {
         $this->db->rollback();
         return parent::resWithErrMsg($modelUser->getMessages());
     }
     $this->db->commit();
     return parent::success();
 }
开发者ID:junyichiu,项目名称:Phalcon-RESTful-Server,代码行数:12,代码来源:PublicController.php

示例5: setUser

 /**
  * Public: Set user
  */
 public function setUser($username)
 {
     $app = App::getInstance();
     try {
         parent::__construct($username);
     } catch (\FelixOnline\Exceptions\ModelNotFoundException $e) {
         User::createUser($username);
         parent::__construct($username);
     }
     $this->setVisits($this->getVisits() + 1);
     $this->setIp($app['env']['REMOTE_ADDR']);
     $this->setTimestamp(time());
     $this->save();
 }
开发者ID:felixonline,项目名称:core,代码行数:17,代码来源:CurrentUser.php

示例6: post_index

 function post_index($f3)
 {
     $user = \User::createUser(\kksd\Sesi::$DB);
     $user->load(array("email=?", $f3->POST['email']));
     if ($user->checkLogin($f3->get('POST.email'), $f3->get('POST.password'))) {
         $user->load(array("email=?", $f3->POST['email']));
         $f3->SESSION['user_type'] = 'admin';
         if (!$f3->POST['remember']) {
             $f3->SESSION['user'] = $user->id;
             $f3->SESSION['user_obj'] = $user;
         } else {
             $f3->set('COOKIE.user', $user->id, time() + 24 * 3600 * 7);
         }
         $f3->reroute('@admin_home');
         return;
     }
     \Flash::instance()->addMessage('Wrong password, you morron!', 'danger');
     $this->index($f3);
     return;
 }
开发者ID:Kekesed,项目名称:Kambeng-Blog,代码行数:20,代码来源:Auth.php

示例7: testUser

 static function testUser()
 {
     $user = new User();
     $logout = User::logout();
     $_POST["user"] = self::generateRandomString();
     $_POST["pass"] = self::generateRandomString();
     $_POST["email"] = self::generateRandomString();
     if ($register = User::createUser()) {
         echo 'CREATE USER: <font color="green">Stworzono uzytkownika o id: ' . $register . ' Dane: ' . $_POST["user"] . ' Haslo: ' . $_POST["pass"] . '</font></br>';
     } else {
         echo 'CREATE USER: <font color="red">ERROR!</font>';
     }
     $login = User::login();
     $id = User::getUID();
     if ($login == true) {
         echo 'LOGIN: <font color="green">Zalogowano, twoje UID: ' . $id . '</font></br>';
     } else {
         echo '<font color="red">LOGIN: ERROR!</font></br>';
         return false;
     }
     if (User::checkLogin()) {
         echo 'CHECK LOGIN: <font color="green">Zalogowany</font></br>';
     } else {
         echo 'CHECK LOGIN: <font color="red">Niezalogowany</font></br>';
         return false;
     }
     if ($delete = User::deleteUser() == true) {
         echo 'DELETE USER: <font color="green">Usunieto uzytkownika</font></br>';
     } else {
         echo 'DELETE USER: <font color="red">ERROR</font></br>';
         return false;
     }
     User::logout();
     if (!isset($_SESSION["uid"])) {
         echo 'LOGOUT: <font color="green">Wylogowano!</font></br>';
     } else {
         echo 'LOGOUT: <font color="red">ERROR!</font></br>';
         return false;
     }
     return true;
 }
开发者ID:oneacik,项目名称:foodfront-website,代码行数:41,代码来源:unit_tests.php

示例8: registerAction

 public function registerAction()
 {
     //	$formRegister= new Form_User();
     $formUser = new Form_User();
     $formUser->removeElement('avatar');
     $formUser->removeElement('status');
     $formUser->removeElement('role');
     $formUser->removeElement('profile');
     if ($this->getRequest()->isPost()) {
         if (!$formUser->isValid($_POST)) {
             $userData = $formUser->getValues();
             $modelUser = new User();
             $newUser = $modelUser->createUser($userData);
             if ($newUser) {
                 $this->_redirect('/user/account/id/' . $newUser);
             }
         }
     }
     $this->view->formUser = $formUser;
     //$this -> view -> formUser = $formRegister;
 }
开发者ID:veaglefly,项目名称:BlogCodes,代码行数:21,代码来源:UserController.php

示例9: pgpSignUp

 public function pgpSignUp()
 {
     if (self::sessionGet('signin_text')) {
         return Redirect::to('success');
     }
     if (Request::isMethod('get')) {
         return View::make('auth.signup');
     } else {
         $input = Input::only('key', 'info');
         User::validate($input);
         self::botLimit();
         $info = $this->checkKey($input['key']);
         if (User::where('user_fp', '=', $info['fingerprint'])->first() != NULL) {
             return Redirect::to('retrieve');
         }
         $result = User::createUser($info['fingerprint'], $input);
         $this->gpg->addencryptkey($info['fingerprint']);
         $text = self::formatSignupText($result['user']->id, $result['priv_hash']);
         self::sessionSet('signin_text', $this->gpg->encrypt($text));
         return Redirect::to('success');
     }
 }
开发者ID:libre-net-society,项目名称:onelon,代码行数:22,代码来源:AuthController.php

示例10: MakeNotification

                    $notifications[] = MakeNotification("error", Language::Get('main', 'differentPasswords', $langTemplate));
                }
            } else {
                $notifications[] = MakeNotification("error", Language::Get('main', 'incorrectOldPassword', $langTemplate));
            }
        } else {
            $notifications = $notifications + $f->notifications;
        }
    } else {
        if ($_POST['action'] == "SetAccountInfo") {
            $f = new FormEvaluator($_POST);
            $f->checkStringForKey('language', FormEvaluator::OPTIONAL, 'warning', '???.');
            if ($f->evaluate(true)) {
                $foundValues = $f->foundValues;
                $language = $foundValues['language'];
                $newUserSettings = User::encodeUser(User::createUser($uid, null, null, null, null, null, null, null, null, null, null, null, null, null, $language));
                $URI = $databaseURI . "/user/" . $uid;
                http_put_data($URI, $newUserSettings, true, $message);
                if ($message == "201") {
                    $notifications[] = MakeNotification("success", Language::Get('main', 'languageChanged', $langTemplate));
                }
            } else {
                $notifications = $notifications + $f->notifications;
            }
        }
    }
}
// load user data from the database
$databaseURI = $getSiteURI . "/accountsettings/user/{$uid}";
$accountSettings_data = http_get($databaseURI, true);
$accountSettings_data = json_decode($accountSettings_data, true);
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:AccountSettings.php

示例11: User

<?php

/**
 * Created by PhpStorm.
 * User: Dushyant
 * Date: 2015-10-30
 * Time: 12:00 PM
 */
//user class required
require_once "../../Local/Classes/class.User.inc";
extract($_POST);
if (isset($btnSubmit)) {
    $user = new User();
    $result = $user->createUser($txtFirstName, $txtLastName, $txtEmail, $txtPassword, $drpUserRole, $txtBirthDate, $rdbGender, $txtCredentials, $txtWorkPhone, $txtCellPhone, $txtFax, $txtAddress, $txtCity, $drpStdProvince, $txtPostalCode, $txtRegistrationNumber, $txtLicenseNumber);
    if ($result === true) {
        $notifications['addUserSuccess'] = "New user is success fully added";
    } else {
        $notifications['addUserError'] = $result;
    }
}
//include header and sidebar
include "header.php";
include "sidebar.php";
?>
    <form role="form" id="frm" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
        <div class="form-group">
            <div id="page-wrapper">
                <!--Notifications-->
开发者ID:Dushyant099,项目名称:Vision_EHR,代码行数:31,代码来源:addUser.php

示例12: actionRegister

 public function actionRegister()
 {
     if (!param('useUserRegistration', 0)) {
         throw404();
     }
     $this->showSearchForm = false;
     $this->layout = '//layouts/inner';
     if (Yii::app()->user->isGuest) {
         if (param('user_registrationMode') == 'without_confirm') {
             $model = new User('register_without_confirm');
         } else {
             $model = new User('register');
         }
         if (isset($_POST['User']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
             $model->attributes = $_POST['User'];
             if ($model->validate()) {
                 $model->activatekey = User::generateActivateKey();
                 $user = User::createUser($model->attributes);
                 if ($user) {
                     $model->id = $user['id'];
                     $model->password = $user['password'];
                     $model->email = $user['email'];
                     $model->username = $user['username'];
                     $model->activatekey = $user['activatekey'];
                     $model->activateLink = $user['activateLink'];
                     $notifier = new Notifier();
                     $notifier->raiseEvent('onNewUser', $model, array('user' => $user['userModel']));
                     if (param('user_registrationMode') == 'without_confirm') {
                         $login = new LoginForm();
                         $login->setAttributes(array('username' => $user['username'], 'password' => $user['password']));
                         if ($login->validate() && $login->login()) {
                             User::updateUserSession();
                             User::updateLatestInfo(Yii::app()->user->id, Yii::app()->controller->currentUserIp);
                             $this->redirect(array('/usercpanel/main/index'));
                         } else {
                             /*echo 'getErrors=<pre>';
                             		print_r($login->getErrors());
                             		echo '</pre>';
                             		exit;*/
                             showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered.'));
                         }
                     } else {
                         showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered. The letter for account activation has been sent on {useremail}', array('{useremail}' => $user['email'])));
                     }
                 } else {
                     showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'Error. Repeat attempt later'));
                 }
             } else {
                 $model->unsetAttributes(array('verifyCode'));
             }
         }
         $this->render('register', array('model' => $model));
     } else {
         $this->redirect('index');
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:56,代码来源:SiteController.php

示例13: function

 */
$app = new \Slim\Slim();
/**
 * Step 3: Define the Slim application routes
 *
 * Here we define several Slim application routes that respond
 * to appropriate HTTP request methods. In this example, the second
 * argument for `Slim::get`, `Slim::post`, `Slim::put`, `Slim::patch`, and `Slim::delete`
 * is an anonymous function.
 */
// GET route
$app->get('/', function () {
    //instance of User class
    $u = new User();
    $conn = $u->connect();
    $u->createUser($conn, 'milos', 'babic', '1988-04-15', 'Serbia', 'baki', '123', 'a@a.a');
});
// GET rerister/ registration form
$app->get('/register', function () {
    echo "\n        <form action='' method='post'>\n            <label>first name</label><br />\n            <input type='text' name='txt_name' /><br />\n            <label>last name</label><br />\n            <input type='text' name='txt_surname' /><br />\n            <label>date of birth (DD/MM/YYYY)</label><br />\n            <input type='text' name='txt_day' /><input type='text' name='txt_mounth' /><input type='text' name='txt_year' /><br />\n            <label>coutry</label><br />\n            <input type='text' name='txt_country' /><br />\n            <label>username</label><br />\n            <input type='text' name='txt_username' /><br />\n            <label>pasword</label><br />\n            <input type='password' name='txt_pass' /><br />\n            <label>email</label><br />\n            <input type='text' name='txt_email' /><br />\n            <input type='submit' name='btn_register' value='register' />\n        </form>\n        ";
});
// POST route
$app->post('/register', function () {
    //db for later check of existing username
    $u = new User();
    $conn = $u->connect();
    //cehck if some post aprams are missing
    if (empty($_POST['first_name']) || empty($_POST['last_name']) || empty($_POST['date_of_birth']) || empty($_POST['country']) || empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])) {
        returnError('Missing or empty post parameters.');
    }
    //assigning post paramms to variables
开发者ID:bakarisanja,项目名称:testone,代码行数:31,代码来源:index.php

示例14: User

                        	<label> Nama Depan : <input type="text" name="fname"  required autofocus></label>
                        </p>
                        <p>
                        <label> Nama Belakang : <input type="text" name="lname"  required autofocus></label>
                        </p>
                        <p>
                        <label> Username : <input type="text" name="username"  required autofocus></label>
                        </p>
                        <p>
                        <label> Password :  <input type="password" name="pass" required></label>
                        </p>
                        <p>
                        <label> Profile Picture :  <input type="file" name="photo" id="photo" ></label>
                        </p>
                        <button type="submit" name="regist">Register</button>

                    </fieldset>
                </form>
            </div>
        </div>
    
    </body>


</html>
<?php 
include 'Loginclass.php';
$user = new User();
if (isset($_POST['regist'])) {
    $user->createUser();
}
开发者ID:ronayumik,项目名称:Laboratory-Recruitment-Project---Am-I-Safe,代码行数:31,代码来源:registrasi.php

示例15: test_input

        if (empty($_POST["comment"])) {
            $comment = " ";
        } else {
            $comment = test_input($_POST["comment"]);
        }
        if ($name = "" && ($lastname = "" && $create_email_error == "" && $create_password_error == "" && ($gender = ""))) {
            echo "Saab kasutajat luua! Kasutajanimi on " . $create_email . " ja parool on " . $create_password;
            $password_hash = hash("sha512", $create_password);
            echo "<br>";
            echo $password_hash;
            //createUser($name, $lastname, $create_email, $password_hash, $age, $gender);
            /*  $stmt = $mysqli->prepare("INSERT INTO users (name, lastname, email, password, age, gender) VALUES (?, ?, ?, ?, ?, ?)");
            				$stmt->bind_param("ssssis", $name, $lastname, $create_email, $create_password, $age, $gender);
            				$stmt->execute();
            				$stmt->close(); */
            $create_response = $User->createUser($name, $lastname, $create_email, $password_hash, $gender);
        }
    }
    // create if end
}
// funktsioon, mis eemaldab koikvoimaliku uleliigse tekstist
function test_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
// siin kirjutame uut php koogdi
/*
//(kehtestame) m22rame email'i vigu
开发者ID:katariin,项目名称:3.kodutoo-II-ruhm,代码行数:31,代码来源:vlogin.php


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