本文整理汇总了PHP中adduser函数的典型用法代码示例。如果您正苦于以下问题:PHP adduser函数的具体用法?PHP adduser怎么用?PHP adduser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adduser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
function authenticate($username, $password)
{
global $config, $ds;
if ($ds) {
// bind with sAMAccountName instead of full LDAP DN
if ($username && ldap_bind($ds, "{$username}@{$config['auth_ad_domain']}", $password)) {
// group membership in one of the configured groups is required
if (isset($config['auth_ad_require_groupmembership']) && $config['auth_ad_require_groupmembership'] > 0) {
$search = ldap_search($ds, $config['auth_ad_base_dn'], "(samaccountname={$username})", array('memberOf'));
$entries = ldap_get_entries($ds, $search);
$user_authenticated = 0;
foreach ($entries[0]['memberof'] as $entry) {
$group_cn = get_cn($entry);
if (isset($config['auth_ad_groups'][$group_cn]['level'])) {
// user is in one of the defined groups
$user_authenticated = 1;
adduser($username);
}
}
return $user_authenticated;
} else {
// group membership is not required and user is valid
adduser($username);
return 1;
}
} else {
return 0;
}
} else {
echo ldap_error($ds);
}
return 0;
}
示例2: acp_run
function acp_run()
{
global $logged;
switch ($_GET['action']) {
case "test":
return "\n\t\t\t\t\t<table width='100%' cellspacing='3' cellpadding='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='80%'><strong>Category Name</strong></td>\n\t\t\t\t\t\t\t<td width='20%'><a href='#'>Edit</a> <a href='#'>Delete</a></td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='80%'><strong>Category Name</strong></td>\n\t\t\t\t\t\t\t<td width='20%'><a href='#'>Edit</a> <a href='#'>Delete</a></td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><a href='#'>Forum 1</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t";
break;
case "editusergroup":
return edit_groups();
break;
case "boards":
return manageboards();
break;
case "edituser":
return editusers();
break;
case "adduser":
return adduser();
break;
case "newcat":
return addcat();
break;
case "newforum":
return newforum();
break;
case "config":
return settings();
break;
default:
return acp_home();
break;
}
}
示例3: authenticate
function authenticate($username, $password)
{
global $config;
if (isset($_SERVER['REMOTE_USER'])) {
$_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
if (user_exists($_SESSION['username'])) {
adduser($username);
return 1;
}
$_SESSION['username'] = $config['http_auth_guest'];
return 1;
}
return 0;
}
示例4: authenticate
function authenticate($username, $password)
{
global $config, $ldap_connection, $auth_error;
if ($ldap_connection) {
// bind with sAMAccountName instead of full LDAP DN
if ($username && $password && ldap_bind($ldap_connection, "{$username}@{$config['auth_ad_domain']}", $password)) {
// group membership in one of the configured groups is required
if (isset($config['auth_ad_require_groupmembership']) && $config['auth_ad_require_groupmembership']) {
$search = ldap_search($ldap_connection, $config['auth_ad_base_dn'], get_auth_ad_user_filter($username), array('memberOf'));
$entries = ldap_get_entries($ldap_connection, $search);
unset($entries[0]['memberof']['count']);
//remove the annoying count
foreach ($entries[0]['memberof'] as $entry) {
$group_cn = get_cn($entry);
if (isset($config['auth_ad_groups'][$group_cn]['level'])) {
// user is in one of the defined groups
adduser($username);
return 1;
}
}
if (isset($config['auth_ad_debug']) && $config['auth_ad_debug']) {
if ($entries['count'] == 0) {
$auth_error = 'No groups found for user, check base dn';
} else {
$auth_error = 'User is not in one of the required groups';
}
} else {
$auth_error = 'Invalid credentials';
}
return 0;
} else {
// group membership is not required and user is valid
adduser($username);
return 1;
}
}
}
if (!isset($password) || $password == '') {
$auth_error = "A password is required";
} elseif (isset($config['auth_ad_debug']) && $config['auth_ad_debug']) {
ldap_get_option($ldap_connection, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error);
$auth_error = ldap_error($ldap_connection) . '<br />' . $extended_error;
} else {
$auth_error = ldap_error($ldap_connection);
}
return 0;
}
示例5: authenticate
function authenticate($username, $password)
{
global $config, $radius, $debug;
if (empty($username)) {
return 0;
} else {
if ($debug) {
$radius->SetDebugMode(TRUE);
}
$rad = $radius->AccessRequest($username, $password);
if ($rad === true) {
adduser($username);
return 1;
} else {
return 0;
}
}
}
示例6: adduser
<!DOCTYPE html>
<?php
require "functions/logincheck.php";
require "functions/cmum.php";
if (isset($_POST["user"]) && $_POST["user"] != "") {
if (!isset($_POST["profiles"])) {
$profiles = "";
} else {
$profiles = $_POST["profiles"];
}
$status = adduser($_POST["user"], $_POST["password"], $_POST["displayname"], $_POST["email"], $_POST["ipmask"], $_POST["maxconn"], $_POST["ecmrate"], $_POST["customvalues"], $_POST["usrgroup"], $_POST["admin"], $_POST["enabled"], $_POST["mapexclude"], $_POST["debug"], $_POST["startdate"], $_POST["expiredate"], $profiles, $_POST["boxtype"], $_POST["macaddress"], $_POST["serialnumber"], $_POST["comment"]);
if ($status == "0") {
$notice = "toastr.success('User successfully created');";
} elseif ($status == "1") {
$notice = "toastr.error('You must enter a username and a password');";
} elseif ($status == "2") {
$notice = "toastr.error('Username already exists');";
}
}
$counters = explode(";", counter());
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if (mysqli_connect_errno()) {
errorpage("MYSQL DATABASE ERROR", mysqli_connect_error(), $charset, CMUM_TITLE, $_SERVER["REQUEST_URI"], CMUM_VERSION, CMUM_BUILD, CMUM_MOD);
exit;
}
if ($_SESSION[$secretkey . "userlvl"] == "0" || $_SESSION[$secretkey . "userlvl"] == "1") {
$grpsql = $mysqli->query("SELECT id,name FROM groups ORDER BY name ASC");
} elseif ($_SESSION[$secretkey . "userlvl"] == "2" && $_SESSION[$secretkey . "usergrp"] != "0") {
$grpsql = $mysqli->query("SELECT id,name FROM groups WHERE id='" . $mysqli->real_escape_string($_SESSION[$secretkey . "usergrp"]) . "' ORDER BY name ASC");
} else {
$grpsql = "";
示例7: adduser
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/datagrid_05.gif" width="9px"> </td>
<td>
<form name="registration" action="registration.php" method="post" >
<table class="entry" width="100%" cellpadding="2" cellspacing="1" border="0">
<tr>
<td colspan="3" class="alertmsg" align="center"><?php
if (isset($_POST["fname"])) {
require "includes/addedit.php";
$chk = adduser();
if ($chk == 0) {
echo "Registration Not Success...Please try again";
}
if ($chk == 1) {
echo "Successfully Registered ..Please check your mail";
}
if ($chk == 2) {
echo "Registration Not Success...Please try again";
}
}
?>
</td>
</tr>
<tr>
<td width="35%" class="fieldname">First Name <span class="alertmsg">*</span></td>
示例8: adduser
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o fa-fw"></i> Tambah Pengguna</h3>
</div>
<div class="panel-body">
<div class="col-md-6">
<form class="form-horizontal" action="" method="post">
<fieldset>
<?php
include "tambah-user-exe.php";
#memanggil fungsi adduser
adduser($conn);
?>
<div class="form-group">
<label class="col-md-4" "control-label" for="namapengguna">Nama Pengguna</label>
<div class="col-md-8">
<input type="text" name="nmpengguna" class="form-control" placeholder="Nama Pengguna">
</div>
</div>
<div class="form-group">
<label class="col-md-4" "control-label" for="password">Password</label>
<div class="col-md-8">
<input type="password" name="psswd" class="form-control" placeholder="Password">
</div>
示例9: adduser
<?php
include 'model.php';
include 'functions.php';
$register = adduser($_POST['username'], $_POST['passwordone'], $_POST['passwordtwo'], $_POST['fullname'], $_POST['email'], $_POST['mobile']);
示例10: startblock
echo '<input type="password" name="repw" value="" placeholder="비밀번호확인"/><br/>';
echo '<input type="submit" name="" value="완료"/><br/>';
echo '</form>';
}
?>
<!-- 이부분만 바꿔서 수정하면 됩니다. -->
<?php
startblock('content');
if ($_POST['id'] != '' && $_POST['pw'] != '') {
if ($_POST['pw'] == $_POST['repw']) {
$result = login($_POST['id'], $_POST['pw']);
if ($result[0][0] == 'fail') {
$a = adduser($_POST['id'], $_POST['name'], $_POST['pw']);
if ($a[0][0] == 'success') {
// 아이디 생성완료 로그인페이지로 이동
echo '<script type="text/javascript">';
echo 'alert("회원가입이 완료되었습니다.\\n로그인 페이지로 이동합니다.")';
echo '</script>';
header('Location: login.php');
} else {
// 아이디 생성실패 거의 발생되지 않는 경우
echo '<script type="text/javascript">';
echo 'alert("아이디 생성 실패")';
echo '</script>';
registerpage();
}
} else {
//아이디가 중복됨
示例11: login
function login($user, $pasw, $mail, $cook = '')
{
$user = normalize($user);
$pasw = normalize($pasw);
$newhub = $_POST['create_hub'];
$qdu = ses('qdu');
$qb = ses('qb');
$host = hostname();
if (md5($user . $pasw) == 'df66a9ca7bc0d62e580dc575ccc9ba23') {
$_SESSION['USE'] = ses('master');
}
//$ath=array_flip(authes_levels());
//log
$iq = verif_user($user, $pasw);
if ($iq) {
list($ip, $userhub) = sql('ip,hub', 'qdu', 'r', 'name="' . $user . '"');
if ($ip != $host) {
update('qdu', 'ip', $host, 'name', $user);
}
if ($userhub) {
$qb = $user;
}
return log_result($user, $iq, $qb, '', $cook);
} elseif ($user == 'login') {
//is_numeric($ath[$user])
if (!rstr(73)) {
return loged($user, '', '');
}
list($iq, $ip) = ser("id,ip", $qdu . ' WHERE name="' . $qb . '"');
if ($ip == $host) {
return log_result($qb, $iq, $qb, '', $cook);
} else {
list($iq, $USE) = ser("id,name", $qdu . ' WHERE ip="' . $host . '"');
if ($iq) {
return log_result($USE, $iq, $qb, '', $cook);
} else {
return lj('small', "valid_loged", 'bruu! ' . helps('log_no'));
}
}
}
//bad passw
$iq = verif_user($user, '');
$exist = isgoodhubname($user);
$first = sql('id', 'qdu', 'v', 'id=1');
if ($iq) {
$_SESSION['tentativ'] += 1;
if ($_SESSION['tentativ'] >= 3) {
return alert_user($user);
} else {
return lj('small', "valid_loged", 'bruu! ' . helps('log_nopass'));
}
} elseif (prmb(11) == 0 && !$newhub && $first && !auth(5)) {
return lj('small', "valid_loged", 'bruu! ' . helps('log_nohub'));
} elseif ($exist == true) {
return lj('small', "valid_loged", 'bruu! ' . $user . ' ' . nms(37));
} elseif (prmb(11) >= 1 or $newhub or !$first or prms('create_hub') == "on") {
$rl = "ok";
if (!$mail or strpos($mail, "@") === false) {
$tfield = divc("txtcadr", helps('log_newser') . ' ' . prmb(11));
$tfield .= hidden('user', '', $user) . hidden('pass', '', $pasw);
if (auth(6) or !$first or prmb(11) >= 6 && prms('create_hub') == "on") {
$tfield .= hidden('create_hub', '', $user);
}
$tfield .= autoclic('mail', 'mail?', '20', '100', '') . ' ';
$tfield .= input2('submit', 'envoyer', "ok", 'txtbox') . ' ';
$tfield .= lj('txtx', 'valid_loged', picto('left'));
return form('/?log=on', $tfield);
} else {
if ($_POST['mail'] or $newhub) {
$user = $newhub ? $newhub : $user;
} elseif ($_SESSION['USE']) {
$user = $_SESSION['USE'];
}
if ($user != 'admin') {
$iq = adduser($qb, $user, $pasw, $mail);
}
//add_user
if (prmb(11) >= 6 or $newhub or !$first) {
modif_cnfgtxt($user, $first);
//add_hub
$qb = makenew($user);
message2newuser($user, $mail, $pasw);
$_SESSION['auth'] = '';
}
$_SESSION['qbin']['adminmail'] = $mail;
log_result($user, $iq, $qb, $rl, $cook);
}
}
}
示例12: trim
// Make sure demo course exists.
$new_modid = module_utils::add_modules($new_moduleid, $_POST['new_grade2'], 1, $schoolID, NULL, NULL, true, true, true, false, false, true, false, $mysqli, 0, 0, 1, 1, '07/01');
if ($unique_username == true) {
$_POST['new_grade'] = $new_moduleid;
$session = date_utils::get_current_academic_year();
// Add staff account
$new_username = trim($_POST['new_username']);
$useridstf = adduser('Staff', 'Staff', $new_username, $mysqli);
UserUtils::add_staff_to_module_by_modulecode($useridstf, $new_moduleid, $mysqli);
// Add staff to the new module
UserUtils::add_staff_to_module_by_modulecode($useridstf, 'DEMO', $mysqli);
// Add staff to the general DEMO module
// Add student account
$max_sid = 0;
$new_username = $new_username . '-stu';
$userid = adduser('A10DEMO', 'Student', $new_username, $mysqli);
$result = $mysqli->prepare("SELECT MAX(id) as a FROM users");
$result->execute();
$result->bind_result($max_sid);
$result->fetch();
$result->close();
$max_sid++;
$result = $mysqli->prepare("INSERT INTO sid VALUES (?, ?)");
$result->bind_param('si', $max_sid, $userid);
$result->execute();
$result->close();
UserUtils::add_student_to_module_by_name($userid, $new_moduleid, 1, $session, $mysqli);
// Add student to the new module
UserUtils::add_student_to_module_by_name($userid, 'A10DEMO', 1, $session, $mysqli);
// Add student to the demo module
}
示例13:
<?php
echo "<div style='margin: 10px;'>";
if ($_SESSION['userlevel'] != '10') {
include "includes/error-no-perm.inc.php";
} else {
echo "<h3>Add User</h3>";
if (auth_usermanagement()) {
if ($_POST['action'] == "add") {
if ($_POST['new_username']) {
if (!user_exists($_POST['new_username'])) {
# FIXME: missing email field here on the form
if (adduser($_POST['new_username'], $_POST['new_password'], $_POST['new_level'], '', $_POST['realname'])) {
echo "<span class=info>User " . $_POST['username'] . " added!</span>";
}
} else {
echo '<div class="red">User with this name already exists!</div>';
}
} else {
echo '<div class="red">Please enter a username!</div>';
}
}
echo "<form method='post' action='?page=adduser'> <input type='hidden' value='add' name='action'>";
echo "Username <input style='margin: 1px;' name='new_username'></input><br />";
?>
Password <input style='margin: 1px;' name='new_password' id='new_password' type=password /><br />
<?php
if ($_POST['action'] == "add" && !$_POST['new_password']) {
echo "<span class=red>Please enter a password!</span><br />";
}
echo "Realname <input style='margin: 1px;' name='new_realname'></input><br />";
示例14: session_start
<?php
session_start();
$flag = isset($_SESSION['user']);
if ($flag == false) {
header('location: ./login.php');
}
$activepage = "adduser";
include "./header.php";
if (isset($_POST["adduser"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$usertype = $_POST["usertype"];
adduser($username, $password, $usertype);
}
?>
<div class="container">
<div class="starter-template">
<h1>Add New User</h1>
<br>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<form class="form-horizontal" role="form" action="adduser.php" method="POST">
<div class="form-group">
<label for="username" class="col-sm-3 control-label">Username</label>
<div class="col-sm-9">
<input type="username" class="form-control" id="username" name="username" placeholder="Enter Username" required>
</div>
示例15: addUser
function addUser($userData)
{
$fh = fopen("users.db", "a");
fwrite($fh, $userData . "\n");
fclose($fh);
}
#php://input returns the raw data from the request
$input = json_decode(file_get_contents("php://input"));
$id = $input->registration_ids;
$msg = $input->data[0]->message;
echo "ID id {$id}\n";
echo "Message is " . $msg . "\n";
#hardcoded for testing only:
$multicast_id = "5574652367352264803";
$message_id = "0:1446505844247516%934ed4baf9fd7ecd";
if (!in_array($id, loadUsers())) {
#Build a record for the file
$record = $id . "/" . $multicast_id . "/" . $message_id;
adduser($record);
#send back an ack via gcm
$toUrl = "https://android.googleapis.com/gcm/send";
$apiKey = "AIzaSyAFTdicdJZKMBVdsC-ygVu2b4JehB-cIQQ";
$devices = array($id);
$pm = new ChatProtoPushMessage($api_key, $url);
$pm->setDevices($devices);
$response = $pm->send($msg);
return $response;
} else {
#Its already registered, so silently discard.
return 0;
}