本文整理汇总了PHP中user::add_user方法的典型用法代码示例。如果您正苦于以下问题:PHP user::add_user方法的具体用法?PHP user::add_user怎么用?PHP user::add_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::add_user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IMPORT_MEMBERS
function IMPORT_MEMBERS()
{
$me = $_SERVER["SERVER_NAME"];
$error = array();
$members = unserialize(base64_decode($_POST["MEMBERS"]));
writelogs("Analyze " . count($members) . " members for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
while (list($uid, $array) = each($members)) {
writelogs("Analyze {$uid} for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
$user = new user($uid);
if ($user->UserExists) {
$user->password = $array["password"];
if ($user->add_user()) {
$success[] = "{$me}::IMPORT_MEMBERS:: Success updating {$uid} in LDAP database";
} else {
$error[] = "Failed updating {$uid} in LDAP database\n {$user->ldap_error}";
}
continue;
}
while (list($key, $value) = each($array)) {
$user->{$key} = $value;
}
if ($user->add_user()) {
$success[] = "{$me}::IMPORT_MEMBERS:: Success adding {$uid} in LDAP database";
} else {
$error[] = "Failed adding {$uid} in LDAP database\n {$user->ldap_error}";
}
}
if (count($error) > 0) {
echo "<ERROR>" . @implode("\n", $error) . "</ERROR>";
}
if (count($success) > 0) {
echo "<SUCCESS>" . @implode("\n", $success) . "</SUCCESS>";
}
}
示例2: signup_control
function signup_control()
{
if (filter_input(INPUT_GET, 'user') && filter_input(INPUT_GET, 'pass') && filter_input(INPUT_GET, 'email') && filter_input(INPUT_GET, 'phone')) {
$obj = new user();
$username = sanitize_string(filter_input(INPUT_GET, 'user'));
$password = sanitize_string(filter_input(INPUT_GET, 'pass'));
$email = sanitize_string(filter_input(INPUT_GET, 'email'));
$phone = sanitize_string(filter_input(INPUT_GET, 'phone'));
if ($obj->add_user($username, $password, $email, $phone)) {
$msg = "Dear, " . $username . "\n";
$msg .= "Thank You for joining book reviews. \n";
$msg .= "We are delighted you have become a part of this wonderful learning experience";
$msg .= "Read Right With BOOK REVIEWS!!!";
$to = $email;
$subject = "Welcome";
$headers = "From: kenneth.mensah@ashesi.edu.gh";
$_SESSION['phone'] = $phone;
mail($to, $subject, $msg, $headers);
echo '{"result":1,"username": "' . $username . '",
"email": "' . $email . '", "phone": "' . $phone . '"}';
} else {
echo '{"result":0,"message": "signup unsuccessful"}';
}
}
}
示例3: PhotoUploaded
function PhotoUploaded()
{
$tmp_file = $_FILES['photo']['tmp_name'];
$content_dir = dirname(__FILE__) . "/ressources/conf/upload";
if (!is_dir($content_dir)) {
@mkdir($content_dir);
}
if (!@is_uploaded_file($tmp_file)) {
writelogs("PHOTO: error_unable_to_upload_file", __FUNCTION__, __FILE__, __LINE__);
$GLOBALS["Photo_error"] = '{error_unable_to_upload_file} ' . $tmp_file;
return;
}
$name_file = $_FILES['photo']['name'];
if (file_exists($content_dir . "/" . $name_file)) {
@unlink($content_dir . "/" . $name_file);
}
if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
$GLOBALS["Photo_error"] = "{error_unable_to_move_file} : " . $content_dir . "/" . $name_file;
writelogs("PHOTO: {error_unable_to_move_file} : " . $content_dir . "/" . $name_file, __FUNCTION__, __FILE__, __LINE__);
return;
}
$file = $content_dir . "/" . $name_file;
writelogs("PHOTO: {$file}", __FUNCTION__, __FILE__, __LINE__);
if (isset($_POST["uid"])) {
$_GET["uid"] = $_POST["uid"];
$user = new user($_POST["uid"]);
$jpegPhoto_datas = file_get_contents($file);
$user->add_user();
writelogs("PHOTO: Edit: " . strlen($jpegPhoto_datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
if (!$user->SaveUserPhoto($jpegPhoto_datas)) {
$GLOBALS["Photo_error"] = $user->ldap_error;
return;
}
if (is_file($user->thumbnail_path)) {
unlink($user->thumbnail_path);
}
return null;
}
if (isset($_POST["employeeNumber"])) {
$_GET["employeeNumber"] = $_POST["employeeNumber"];
$user = new contacts($_SESSION["uid"], $_POST["employeeNumber"]);
$user->jpegPhoto_datas = file_get_contents($file);
if ($_SESSION["uid"] != -100) {
$ldap = new clladp();
$user2 = new user($_SESSION["uid"]);
$dn = "cn={$user->sn} {$user->givenName},ou={$user2->uid},ou=People,dc={$user2->ou},dc=NAB,{$ldap->suffix}";
if ($dn == $user->dn) {
$user->Save();
} else {
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
}
}
if (is_file($user->thumbnail_path)) {
unlink($user->thumbnail_path);
}
return null;
}
}
示例4: TASK_USER_EDIT
function TASK_USER_EDIT($zmd5)
{
$meta = new artica_meta(true);
include_once dirname(__FILE__) . '/ressources/class.user.inc';
events("Get user informations from {$zmd5}", __FUNCTION__, __FILE__, __LINE__);
$http = new httpget();
$datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
$body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "GET_USER_INFO" => $zmd5));
if (preg_match("#<RESULTS>(.+?)</RESULTS>#", $body, $re)) {
$array = unserialize(base64_decode($re[1]));
}
if (!is_array($array)) {
events("Get user informations ERROR not an Array", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed to add user task id \"{$zmd5}\"", "Error detected\nGet user informations ERROR not an Array", "CLOUD");
return true;
}
foreach ($array as $key => $value) {
$userArray[$key] = $value;
}
$user = new user($userArray["uid"]);
$user->ou = $userArray["ou"];
events("Get user informations {$userArray["uid"]} done", __FUNCTION__, __FILE__, __LINE__);
$ldap = new clladp();
$ldap->AddOrganization($user->ou);
$user->password = $userArray["userpassword"];
$user->mail = $userArray["mail"];
$user->DisplayName = $userArray["displayname"];
$user->homeDirectory = $userArray["homedirectory"];
$user->sn = $userArray["sn"];
$user->group_id = $userArray["gidnumber"];
$user->FTPDownloadBandwidth = $userArray["ftpdownloadbandwidth"];
$user->FTPDownloadRatio = $userArray["ftpdownloadratio"];
$user->FTPQuotaFiles = $userArray["ftpquotafiles"];
$user->FTPQuotaMBytes = $userArray["ftpquotambytes"];
$user->FTPUploadRatio = $userArray["ftpuploadratio"];
$user->postalCode = $userArray["postalcode"];
$user->postalAddress = $userArray["postaladdress"];
$user->street = $userArray["street"];
$user->givenName = $userArray["givenname"];
$user->mobile = $userArray["mobile"];
$user->telephoneNumber = $userArray["telephonenumber"];
$user->zarafaQuotaHard = $userArray["zarafaQuotaHard"];
$user->zarafaQuotaWarn = $userArray["zarafaQuotaWarn"];
$user->zarafaQuotaSoft = $userArray["zarafaQuotaSoft"];
if (trim($userArray["mailboxsecurityparameters"]) == null) {
$userArray["mailboxsecurityparameters"] = "[mailbox]\nl=1\nr=1\ns=1\nw=1\ni=1\np=1\nc=1\nd=1\na=1";
}
if (trim($userArray["mailboxactive"]) == null) {
$userArray["mailboxactive"] = "TRUE";
}
if ($userArray["mailboxactive"] == 1) {
$userArray["mailboxactive"] = "TRUE";
} else {
$userArray["mailboxactive"] = "FALSE";
}
$user->MailboxSecurityParameters = $userArray["mailboxsecurityparameters"];
$user->MailboxActive = $userArray["mailboxactive"];
$user->MailBoxMaxSize = $userArray["mailboxmaxsize"];
events("Saving user information...", __FUNCTION__, __FILE__, __LINE__);
if (!$user->add_user()) {
events("Failed to add user {$userArray["uid"]}", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed to add {$userArray["uid"]}", "reason {$user->error}", "CLOUD");
return false;
} else {
events("Call to unlock user", __FUNCTION__, __FILE__, __LINE__);
$http = new httpget();
send_email_events("Success to add {$userArray["uid"]}", "Adding this user:\n{$userArray["mail"]}\nOrganization:{$userArray["ou"]}\n", "CLOUD");
$body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "UNLOCK_USER" => $zmd5));
return true;
}
}
示例5: MEMBERS_IMPORT_FILE
function MEMBERS_IMPORT_FILE()
{
$file = $_GET["ImportMembersFile"];
$groupid = $_GET["groupid"];
$gg = new groups($groupid);
$ou = $gg->ou;
$MainDomain = null;
if (!isset($GLOBALS["MEM_DOMAINS"][$ou])) {
FILL_MEM_LOCAL_DOMAINS($ou);
}
$MainDomain = $GLOBALS["MEM_DOMAINS"][$ou][0];
unset($GLOBALS["MEM_DOMAINS"][$ou][0]);
writelogs("importing {$file}....", __FUNCTION__, __FILE__);
$datas = file_get_contents($file);
$datas = explode("\n", $datas);
$good = 0;
$bad = 0;
$count_user = 0;
if (is_array($datas)) {
while (list($num, $ligne) = each($datas)) {
if (trim($ligne) == null) {
continue;
}
$ligne = str_replace('"', '', $ligne);
$ligne = str_replace("\r\n", "", $ligne);
$ligne = str_replace("\r", "", $ligne);
$ligne = str_replace("\n", "", $ligne);
$ligne = str_replace("'", "`", $ligne);
$table = explode(";", $ligne);
if ($table[2] == null) {
continue;
}
$count_user = $count_user + 1;
$user = new user();
$user->SIMPLE_SCHEMA = true;
$user->uid = $table[2];
$user->ou = $ou;
$user->DisplayName = $table[0];
if (strpos(trim($user->DisplayName), " ") > 0) {
$splituser = explode(" ", $user->DisplayName);
$user->givenName = $splituser[0];
unset($splituser[0]);
$user->sn = @implode(" ", $splituser);
}
$user->group_id = $groupid;
$user->mail = $table[1];
if ($MainDomain != null) {
if (!preg_match("#(.*?)@(.+)#", $user->mail)) {
$user->mail = "{$user->mail}@{$MainDomain}";
}
}
$user->password = $table[3];
$user->PostalCode = $table[4];
$user->postalAddress = $table[5];
$user->mobile = $table[6];
$user->telephoneNumber = $table[7];
if ($user->add_user()) {
if ($table[8] != null) {
$aliases = explode(',', $table[8]);
if (is_array($aliases)) {
while (list($num1, $mail_ali) = each($aliases)) {
if (trim($mail_ali) == null) {
continue;
}
$user->add_alias($mail_ali);
}
}
}
if (count($GLOBALS["MEM_DOMAINS"][$ou]) > 0) {
reset($GLOBALS["MEM_DOMAINS"][$ou]);
while (list($num1, $domainz) = each($GLOBALS["MEM_DOMAINS"][$ou])) {
$user->add_alias("{$user->uid}@{$domainz}");
}
}
$good = $good + 1;
} else {
$bad = $bad + 1;
}
}
}
$html = "\n\t<strong>{$group_error}</strong>\n\t<table style='width:100%;padding:1px;border:1px solid #CCCCCC'>\n\t<tr>\n\t<th>{success}</th>\n\t<th>{failed}</th>\n\t<th>{members}</th>\n\t</tr>\n\t<tr>\n\t<td align='center'><strong>{$good}</td>\n\t<td align='center'><strong>{$bad}</td>\n\t<td align='center'><strong>{$count_user}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3><strong>{group} N.{$groupid}</strong></td></tr>\n\t</table>\n\t{$logs}\n\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body(RoundedLightWhite($html));
}
示例6: user
<?php
if (isset($_POST['karyawan']) && isset($_POST['username']) && isset($_POST['password']) && $_POST['karyawan'] != "" && $_POST['username'] != "" && $_POST['password'] != "") {
include './app/class.user.php';
$data = new user();
if ($insert = $data->add_user($_POST['karyawan'], $_POST['username'], $_POST['password'])) {
echo "<script> alert('Data tersimpan'); window.location='./?no_spa=" . e_url('./app/user.php') . "'; </script>";
} else {
echo "<script> alert('Gagal menyimpan, cek kembali..!');</script>";
}
}
示例7: elseif
$edit = $staff->edit_departments($_POST['adddepartment'], 'add');
} elseif (isset($_POST['delproduct'])) {
$edit = $staff->edit_products($_POST['delproduct'], 'del');
} elseif (isset($_POST['addproduct'])) {
$edit = $staff->edit_products($_POST['addproduct'], 'add');
}
if ($edit) {
$successmsg = "Operation successfull";
} else {
$errormsg = $staff->get_error();
}
}
if (isset($_POST['name'])) {
$user = new user();
$user->db_open();
$adduser = $user->add_user($_POST['name'], $_POST['regemail'], $_POST['confirmemail'], $_POST['regpassword'], $_POST['confirmpassword'], 2);
if ($adduser) {
$successmsg = "New staff user crated.";
} else {
$errormsg = $user->get_error;
}
}
$departments = $ticket->get_departments();
$products = $ticket->get_products();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Ticket System - Profile</title>
示例8: user
}
if ($_POST['trangthai'] == '') {
$error = 'khong duoc de trong';
} else {
$trangThai = $_POST['trangthai'];
}
if ($tenDangNhap && $matKhau && $email && $hoTen && $maQuyen && $ngayDangKy && $trangThai) {
$user1 = new user();
$user1->set_tk($tenDangNhap);
$user1->set_mk($matKhau);
$user1->setName($hoTen);
$user1->setEmail($email);
$user1->set_qtc($maQuyen);
$user1->setNgaydangky($ngayDangKy);
$user1->setTrangthai($trangThai);
if ($user1->add_user() == "user exist") {
$error = 'tai khoan da ton tai';
} else {
header('location:admin-board.php');
}
}
}
?>
<form method="post">
<span style="color:red; text-align:center;"><h3><?php
if (isset($error)) {
echo $error;
}
?>
</h3></span>
<table align="center" width="400" border="1">
示例9: SaveAllowedSMTP
function SaveAllowedSMTP()
{
$user = new user($_GET["uid"]);
$user->AllowedSMTPTroughtInternet = $_GET["AllowedSMTPTroughtInternet"];
if ($user->add_user()) {
$tpl = new templates();
echo html_entity_decode($tpl->_ENGINE_parse_body("\n{AllowedSMTPTroughtInternet}\n{success}:\n" . $_GET["uid"]));
}
}
示例10: PhotoUploaded
function PhotoUploaded()
{
$tmp_file = $_FILES['photo']['tmp_name'];
$content_dir = dirname(__FILE__) . "/ressources/conf/upload";
if (!is_dir($content_dir)) {
@mkdir($content_dir, 0755, true);
}
if (!is_dir($content_dir)) {
$_GET["Photo_error"] = '{error_unable_to_create_dir} ' . $content_dir;
iframe();
exit;
}
if (!@is_uploaded_file($tmp_file)) {
$_GET["Photo_error"] = '{error_unable_to_upload_file} <code style=font-size:11px>' . $tmp_file . "</code>";
exit;
}
$name_file = $_FILES['photo']['name'];
if (file_exists($content_dir . "/" . $name_file)) {
@unlink($content_dir . "/" . $name_file);
}
if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
$_GET["Photo_error"] = "{error_unable_to_move_file} : <code style=font-size:11px>{$tmp_file}</code> {to} <code style=font-size:11px>" . str_replace(dirname(__FILE__), "", $content_dir) . "/" . $name_file . "</code>";
iframe();
exit;
}
$file = $content_dir . "/" . $name_file;
if (isset($_POST["uid"])) {
$_GET["uid"] = $_POST["uid"];
$user = new user($_POST["uid"]);
$user->jpegPhoto_datas = file_get_contents($file);
$user->add_user();
if (is_file($user->thumbnail_path)) {
unlink($user->thumbnail_path);
}
iframe();
exit;
return null;
}
if (isset($_POST["employeeNumber"])) {
$_GET["employeeNumber"] = $_POST["employeeNumber"];
$user = new contacts($_SESSION["uid"], $_POST["employeeNumber"]);
$user->jpegPhoto_datas = file_get_contents($file);
if ($_SESSION["uid"] != -100) {
$ldap = new clladp();
$user2 = new user($_SESSION["uid"]);
$dn = "cn={$user->sn} {$user->givenName},ou={$user2->uid},ou=People,dc={$user2->ou},dc=NAB,{$ldap->suffix}";
if ($dn == $user->dn) {
$user->Save();
} else {
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
}
}
if (is_file($user->thumbnail_path)) {
unlink($user->thumbnail_path);
}
iframe();
exit;
}
iframe();
exit;
}
示例11: SavevacationInfo
function SavevacationInfo()
{
$info = $_GET["vacationInfo"];
$users = new user($_SESSION["uid"]);
$users->vacationInfo = $info;
if (!$users->add_user()) {
echo $users->ldap_error;
}
}
示例12: CreateThisUser
function CreateThisUser($email)
{
if (!preg_match("#(.+?)@(.+)#", $email, $re)) {
return null;
}
$domain = $re[2];
$uid = $re[1];
$ldap = new clladp();
$ou = $ldap->ou_by_smtp_domain($domain);
if ($ou == null) {
write_syslog("CreateThisUser():: Unable to detect organization by domain \"{$domain}\"", __FILE__);
return null;
}
$ct = new user($uid);
$ct->ou = $ou;
$ct->mail = $email;
$ct->uid = $uid;
if (!$ct->add_user()) {
write_syslog("CreateThisUser():: Unable to Create user {$uid} \"{$email}\"", __FILE__);
return null;
}
$uid2 = $ldap->uid_from_email($email);
write_syslog("CreateThisUser():: new user \"{$uid2}\"", __FILE__);
return $uid2;
}
示例13: save
function save()
{
$tpl = new templates();
$users = new user($_GET["login"]);
if ($users->password != null) {
writelogs("User already exists {$_GET["login"]} ", __FUNCTION__, __FILE__);
echo $tpl->_ENGINE_parse_body('{account_already_exists}');
exit;
}
writelogs("Add new user {$_GET["login"]} {$_GET["ou"]} {$_GET["gpid"]}", __FUNCTION__, __FILE__);
$users->ou = $_GET["ou"];
$users->password = $_GET["password"];
$users->mail = "{$_GET["email"]}@{$_GET["internet_domain"]}";
$users->DisplayName = "{$_GET["firstname"]} {$_GET["lastname"]}";
$users->givenName = $_GET["firstname"];
$users->sn = $_GET["lastname"];
$users->group_id = $_GET["gpid"];
$users->add_user();
}
示例14: importZimbra
function importZimbra($hash, $ou)
{
$uid = $hash["uid"][0];
$displayname = $hash["displayname"][0];
$postalcode = $hash["postalcode"][0];
$street = $hash["street"][0];
$telephonenumber = $hash["telephonenumber"][0];
$homephone = $hash["homephone"][0];
$mobile = $hash["mobile"][0];
$mail = $hash["mail"][0];
$givenname = $hash["givenname"][0];
$sn = $hash["sn"][0];
$userpassword = $hash["userpassword"][0];
$town = $hash["l"][0];
if ($hash["zimbramaildeliveryaddress"][0] != null) {
$aliases[] = $hash["zimbramaildeliveryaddress"][0];
}
if ($mail == null) {
return;
}
if (preg_match("#^admin[@\\.]#", $mail)) {
return;
}
if (preg_match("#^wiki[@\\.]#", $mail)) {
return;
}
if (preg_match("#^spam\\.#", $mail)) {
return;
}
if (preg_match("#^ham\\.#", $mail)) {
return;
}
if (count($hash["zimbramailalias"]["count"] > 0)) {
for ($i = 0; $i < $hash["zimbramailalias"]["count"], $i++;) {
$aliases[] = $hash["zimbramailalias"][$i];
}
}
if (preg_match("#(.+?)@(.+)#", $mail, $re)) {
$domain = $re[2];
}
$user = new user($uid);
$user->ou = $ou;
$user->mail = $mail;
if ($userpassword != null) {
$user->password = $userpassword;
}
if ($givenname != null) {
$user->givenName = $givenname;
}
if ($sn != null) {
$user->sn = $sn;
}
if ($street != null) {
$user->street = $street;
}
if ($displayname) {
$user->DisplayName = $displayname;
}
if ($telephonenumber != null) {
$user->telephoneNumber = $telephonenumber;
}
if ($homephone != null) {
$user->homePhone = $homephone;
}
if ($mobile != nul) {
$user->mobile = $mobile;
}
if ($postalcode != null) {
$user->postalCode = $postalcode;
}
if ($town != null) {
$user->town = $town;
}
$user->domainname = $domain;
echo "Adding/updating {$uid} {$mail} in ou \"{$ou}\"\n";
$user->add_user();
if (is_array($aliases)) {
$user = new user($uid);
while (list($ip, $li) = each($aliases)) {
$user->add_alias($li);
}
}
}
示例15: isset
echo isset($_GET['id']) ? 'Update' : 'Add';
?>
User</h3>
</div>
<div class="panel-body">
<!-- BEGIN DATA TABLE -->
<?php
$user = new user();
$ID = isset($_GET['id']) ? $_GET['id'] : NULL;
if (isset($_POST['add_user'])) {
// Update old record
if (isset($ID)) {
$results = $user->update_user($_POST, $ID);
} else {
// Insert new
$results = $user->add_user($_POST);
}
if ($results) {
echo '<div class="alert alert-success alert-block fade in alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Add Staff Member</strong> Sucessfully
</div>';
} else {
echo '<div class="alert alert-danger alert-block fade in alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Error</strong>
</div>';
}
}
if (isset($ID)) {
$user_result = $user->get_user($ID);