本文整理匯總了PHP中UserClass::newUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserClass::newUser方法的具體用法?PHP UserClass::newUser怎麽用?PHP UserClass::newUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserClass
的用法示例。
在下文中一共展示了UserClass::newUser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: json_encode
<?php
/*****************************
Ajax call to insert user
*****************************/
#start session
session_start();
#require required files
require '../../constants.php';
require '../../dbinfo.inc.php';
require '../../tools.php';
require '../../user.php';
#get post
$user_username = $_POST['user_username'];
$user_password = $_POST['user_password'];
$user_nickname = $_POST['user_nickname'];
$user_level = $_POST['user_level'];
#get crypted password
$user_password_crypt = crypt($user_password, $salt);
#get current group id
$group_id = $UserMasterObject->getUserGroup();
#create new user
$NewUserObject = new UserClass();
$json_out['new_user'] = $NewUserObject->newUser($user_username, $user_password_crypt, $user_nickname, $group_id, $user_level);
#if all json_out == NULL -> succes!
if (!array_filter($json_out)) {
$json_out = array('succes' => 'User added.', 'user_id' => $NewUserObject->getId());
}
#output json
print json_encode($json_out);