本文整理汇总了PHP中UserManager::addUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::addUser方法的具体用法?PHP UserManager::addUser怎么用?PHP UserManager::addUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::addUser方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
$data = array("status" => "fail", "msg" => "New user name must be present - value was '{$newFirstName}' for '{$user_name}'.");
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
if ($action == 'add') {
$newFirstName = $parameters->getValue('newFirstName');
$newLastName = $parameters->getValue('newLastName');
$newUserName = $parameters->getValue('newUserName');
$newImage = $parameters->getValue('newImage');
$newQuantity = $parameters->getValue('newQuantity');
if (!empty($newFirstName) && !empty($newLastName) && !empty($newUserName) && !empty($newImage)) {
$data = array("status" => "success", "msg" => "User added.");
$um = new UserManager();
$um->addUser($newFirstName, $newLastName, $newUserName, $newImage, $newQuantity);
} else {
$data = array("status" => "fail", "msg" => "First name, last name, and user name cannot be empty.");
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
$data = array("status" => "fail", "msg" => "Action not understood.");
}
}
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
if (Utils::isGET()) {
// get means get the list of users
示例2: addDB
/**
* Fonction ajoutant en BDD le nouveau membre inscrit et lui envoyant un message contenant son code d'activation
* d'inscription.
*/
function addDB()
{
$userToAdd = new User(array("UserName" => $_POST['userName'], "email" => $_POST['email'], "Mdp" => $_POST['mdp']));
$code_aleatoire = genererCode();
$adresseAdmin = "no-reply@everydayidea.be";
$to = $userToAdd->getEmail();
$sujet = "Confirmation de l'inscription";
$entete = "From:" . $adresseAdmin . "\r\n";
$entete .= "Content-Type: text/html; charset=utf-8\r\n";
$message = "Nous confirmons que vous êtes officiellement inscrit sur le site EveryDayIdea <br>\n\t\t\t\t\t\t\t\t\tVotre login est : " . $userToAdd->getUserName() . " <br>\n\t\t\t\t\t\t\t\t\tVotre email est : " . $userToAdd->getEmail() . " <br>\n\t\t\t\t\t\t\t\t\tVotre lien d'activation est : <a href='http://www.everydayidea.be/Page/activationInscription.page.php?code=" . $code_aleatoire . "'>Cliquez ici !</a>";
mail($to, $sujet, $message, $entete);
/** @var $um : un nouvel user qui va être ajouté à la BDD
J'ajoute le nouvel user à la BDD*/
$um = new UserManager(connexionDb());
$um->addUser($userToAdd);
/**
* Ici j'ai besoin de savoir quel est le user id du nouveau membre ajouté pour pouvoir le mettre dans l'ajout du code d'activation de cet user
* Donc je vais le rechercher en base de donnée où il vient d'être ajouté
*/
$user = $um->getUserByUserName($userToAdd->getUserName());
$userid = $user->getId();
$um->setUserDroit($user, 4);
/**
* J'ajoute le nouveau code d'activation à la BDD
*/
$am = new ActivationManager(connexionDb());
$activation = new Activation(array("code" => $code_aleatoire, "id_user" => $userid, "libelle" => "Inscription"));
$am->addActivation($activation);
}
示例3: array
$data = array("status" => "fail", "msg" => "User '{$user_name}' was NOT updated with new first name ('{$newFirstName}').");
}
} else {
$data = array("status" => "fail", "msg" => "New user name must be present - value was '{$newFirstName}' for '{$user_name}'.");
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
if ($action == 'add') {
$newFirstName = $parameters->getValue('newFirstName');
$newLastName = $parameters->getValue('newLastName');
$newUserName = $parameters->getValue('newUserName');
if (!empty($newFirstName) && !empty($newLastName) && !empty($newUserName)) {
$data = array("status" => "success", "msg" => "User added.");
$um = new UserManager();
$um->addUser($newFirstName, $newLastName, $newUserName);
} else {
$data = array("status" => "fail", "msg" => "First name, last name, and user name cannot be empty.");
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
$data = array("status" => "fail", "msg" => "Action not understood.");
}
}
}
echo json_encode($data, JSON_FORCE_OBJECT);
return;
} else {
if (Utils::isGET()) {
// get means get the list of users
示例4: PropertyManager
$oSettingsManager->cacheSettings();
// set website timezone
date_default_timezone_set($oSettingsManager->getValue("TimeZone", $fusebox['defaultTimeZone'], "STRING", "Default timezone for website"));
$oPropertyManager = new PropertyManager($oDB, $fusebox['tableProperties'], $fusebox['tableDictionary']);
// user manager initialization
$oUserManager = new UserManager($oDB, $fusebox['tableUsers'], $fusebox['defaultUser'], $fusebox['developer'], $fusebox['password']);
if (!$oUserManager->initialize()) {
_throw("FNoUsersTable", "There is no users table called \"{$fusebox['tableUsers']}\" present in DB");
}
// adding or checking existence of developer, setting developer password to default
if (!$oUserManager->resetPassword($fusebox['developer'], 0, $fusebox['password'])) {
if (!$oUserManager->checkUser($fusebox['developer'])) {
$oDev = new User(0, $fusebox['developer']);
$oDev->setRegisteredDate();
$oDev->setPassword($fusebox['password']);
if ($oUserManager->addUser($oDev)) {
if (!($oDev = $oUserManager->getUser($fusebox['developer']))) {
_throw("FNoDeveloperUserFound", "No developer found... again! DB corrupted ?");
}
unset($oDev);
} else {
_throw("FCannotAddDeveloper", "Cannot add developer");
}
} else {
_throw("FCannotResetDeveloperPassword", "Cannot reset password for developer");
}
}
// getting user
$boolFreshUser = false;
if (!isset($oUser) || !is_a($oUser, "User")) {
if ($oUserManager->checkUser($fusebox['defaultUser'])) {
示例5: unset
if (isset($_POST['regist_x'])) {
unset($_POST['regist_x']);
if ($_POST['login'] == '' || $_POST['pass'] == '' || $_POST['FIO'] == '' || $_POST['adress'] == '') {
?>
<script type="text/javascript">alert("Некоторые обязательные поля остались незаполненными!");</script>
<?php
} else {
$userInfo = new UserInfo();
$userInfo->address = $_POST['adress'];
$userInfo->email = $_POST['email'];
$userInfo->fio = $_POST['FIO'];
$userInfo->isAdmin = 0;
$userInfo->password = $_POST['pass'];
$userInfo->username = $_POST['login'];
$userManager = new UserManager();
$uid = $userManager->addUser($userInfo);
if ($uid == -1) {
?>
<script type="text/javascript">alert("Пользователь с таким именем уже существует!");</script>
<?php
} else {
$userInfo->uid = $uid;
$_SESSION['hasLogined'] = true;
if (isset($_SESSION['basketStuff']) == false) {
$_SESSION['basketStuff'] = new basketStuff();
}
$_SESSION['basketStuff']->setUserInfo($userInfo);
?>
<script type="text/javascript">alert("Регистрация прошла успешно!");</script>
<?php
header("Location: /index.php/");
示例6: LanguageProfManager
$user_insert_id = "";
//contains the city Ids, it will get us the location
//$cityid = $userManager->getuserLocation();
$cityid = '1';
//Inserting into the profecient Table;;
$LProfManager = new LanguageProfManager();
$User->setFirstName($userfname);
$User->setLastName($userlname);
$User->setLogin($userid);
$User->setEmail($emailid);
$User->setPassword($pass);
$User->setDOB($dob);
$User->setLocation($cityid);
$User->setRegistration_date(date("Y-m-d"));
$User->setUserType(4);
$user_insert_id = $userManager->addUser($User);
//echo $user_insert_id;
if ($user_insert_id) {
//$cityid='4';
$prof = [];
$count_prof = count($user_info['mylanguage']);
$i = 0;
if (count($count_prof) > 0) {
for ($i = 0; $i < $count_prof; $i++) {
$lprof[] = new LanguageProf();
$lprof[$i]->setLanguageId($user_info['mylanguage'][$i]);
$lprof[$i]->setProf($user_info['proficient'][$i]);
$lprof[$i]->setUserId($user_insert_id);
if ($LProfManager->AddProficient($lprof[$i])) {
$allworks = true;
//echo '1';
示例7: html_liste_actions
/**
* Ajout d'un utilisateur
* @package Backend
* @subpackage Presentation
* @author Laurent Jouanneau
* @author Florian Hatat
* @copyright Copyright © 2003 OpenWeb.eu.org
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
*/
define('OW_BACKEND_ACTION', 'ACT_ADMIN_ADD');
require_once '../../include/backend/init.inc.php';
echo html_liste_actions();
if (isset($_POST['uti_login'])) {
require_once PATH_INC_BACKEND_SERVICE . 'UserManager.class.php';
$um = new UserManager($db);
if ($um->addUser($_POST['uti_login'])) {
echo "<p>Utilisateur ", $_POST['uti_login'], " ajouté</p>";
} else {
echo "<p>Mise en orbite de ", $_POST['uti_login'], " ratée</p>";
}
exit;
}
?>
<form action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="post">
<fieldset>
<legend>Ajout d'un utilisateur</legend>
<label>Login : <input type="text" id="uti_login" name="uti_login" /></label>
<input type="submit" value="Ajouter" />
示例8: array
}
$err = @Utils::checkInput($_POST['prename'], "Prename", 3, 64, INPUT_TYPE_STRING);
if (strlen($err) != 0) {
$error[] = $err;
}
$err = @Utils::checkInput($_POST['lastname'], "Lastname", 3, 64, INPUT_TYPE_STRING);
if (strlen($err) != 0) {
$error[] = $err;
}
$err = @Utils::checkInput($_POST['email'], "E-Mail", 3, 64, INPUT_TYPE_EMAIL);
if (strlen($err) != 0) {
$error[] = $err;
}
if (count($error) == 0) {
$username = $_POST["username"];
UserManager::addUser($_POST['username'], $_POST['prename'], $_POST['lastname'], $_POST['email']);
$page->assign("t_Report", Reporting::success("The user \"{$username}\" was added successfully."));
} else {
$page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
}
} else {
if ("RemoveCustomer" == $do) {
$error = array();
$err = @Utils::checkInput($_POST['userid'], "User ID", 0, 0, INPUT_TYPE_NUMERIC);
if (strlen($err) != 0) {
$error[] = $err;
} else {
if (!UserManager::existsById($_POST['userid'])) {
$error[] = "The given User ID doesn't exist.";
} else {
$user = new User($_POST['userid']);