Example #1
0
function deleteUser($id)
{
    $form = findUserById($id);
    if (!isset($form)) {
        return;
    }
    if ($form['sfdc'] != "") {
        updateSF('users', $id, $form['sfdc']);
        $accounts = findAccountsByUser($id);
        foreach ($accounts as $account) {
            if ($account['sfdc'] != "") {
                updateSF('org_members', $account['id'], $account['sfdc']);
            }
        }
    }
    $odbc = odbcConnect();
    $stmt = odbc_prepare($odbc, "DELETE FROM org_members WHERE member_id = ? AND member_type = ?");
    $rs = odbc_execute($stmt, array($id, "user"));
    $stmt = odbc_prepare($odbc, "DELETE FROM group_members WHERE member_id = ? AND member_type = ?");
    $rs = odbc_execute($stmt, array($id, "user"));
    $stmt = odbc_prepare($odbc, "DELETE FROM users WHERE id = ?");
    $rs = odbc_execute($stmt, array($id));
    $stmt = odbc_prepare($odbc, "DELETE FROM user_passwords WHERE name = ?");
    $rs = odbc_execute($stmt, array($form["name"]));
    $stmt = odbc_prepare($odbc, "DELETE FROM user_digests WHERE name = ?");
    $rs = odbc_execute($stmt, array($form["name"]));
    odbc_close($odbc);
    return $rs;
}
Example #2
0
<?php

include "adminapi.php";
$id = $_GET['id'];
if (!isset($_POST["id"])) {
    if (!isset($_GET["id"])) {
        return header("Location: index.php");
    }
} else {
    $rs = deleteUser($id);
    echo "deleting user";
    if ($rs == true) {
        header("Location: index.php");
    }
}
$form = findUserById($id);
$pageTitle = "Deleting User: {$form['name']}";
$pageInfo = "";
$submitPage = $_SERVER["REQUEST_URI"];
$submitLabel = "Delete User";
?>

<?php 
include 'header.php';
?>
<body id="edit_user" class="users">
<?php 
make_navbar('Users');
?>

<div id="body" class="wrap">
Example #3
0
                header("Location: edituser.php?id={$id}");
                return;
            }
            $pageInfo = "<b>Update operation failed</b>";
        }
    }
} else {
    // this is a user creation request; fill in name and status
    $pageTitle = "Unable to create user";
    $form["name"] = $_POST["name"];
    $form["status"] = "ActiveUser";
    if ($_POST["password"] != $_POST["password2"]) {
        $pageInfo = "<span style=\"error\">Passwords do not match</span>";
    } else {
        $userid = createUser($form);
        $user = findUserById($userid);
        $org = findOrgByName($_POST['orgName']);
        $group = findGroupByName($_POST['orgName']);
        if (isset($user) && isset($org)) {
            $acct["type"] = "user";
            $acct["userid"] = $user["id"];
            $acct["userName"] = $user["name"];
            $acct["orgid"] = $org["id"];
            $acct["orgName"] = $org["name"];
            $acct["role"] = $_POST["role"];
            $acct["status"] = "Invited";
            $id = createAccount($acct);
            if (isset($id)) {
                if (isset($_POST['activateUser'])) {
                    sendActivationRequest('', $form);
                }
Example #4
0
function checkUserPasswordById($id, $password)
{
    $user = findUserById($id);
    return password_verify($password, $user['password']);
}
Example #5
0
echo do_html_head();
?>
	</div>
	<br/>
	<!-- 导航 -->
	<div>
		&gt;&gt;<b><a href="index.php">论坛首页</a></b>
	</div>
	<!-- 用户信息显示与修改表单 -->
	<div class="t" style="margin-top: 15px" align="center">
		<?php 
if (isset($_SESSION["current_user"])) {
    $current_user = $_SESSION["current_user"];
    $uId = $current_user["uId"];
    //用uId来查询,是为了防止出现重名的现象
    $user = findUserById($uId);
    $formBuf = <<<HTML_FORM
\t\t\t\t\t<form name="userForm" onSubmit="return check()" action="./manage/doUserUpdate.php" enctype="multipart/form-data" method="post">
\t\t\t\t\t\t<input name="uId" type="hidden" value="{$user['uId']}" />
\t\t\t\t\t\t<br/>用&nbsp;户&nbsp;名&nbsp;
\t\t\t\t\t\t<input class="input" tabindex="1" type="text" maxlength="20" size="40" name="uName" value="{$user['uName']}"></input>
\t\t\t\t\t\t<br/>新&nbsp;密&nbsp;码&nbsp;
\t\t\t\t\t\t<input class="input" tabindex="2" type="password" maxlength="20" size="40" name="uPass"></input>
\t\t\t\t\t\t<br/>重复密码&nbsp;
\t\t\t\t\t\t<input class="input" tabindex="3" type="password" maxlength="20" size="40" name="uPass1"></input>
\t\t\t\t\t\t<br/>
HTML_FORM;
    if ($user["gender"] == 1) {
        $formBuf .= <<<HTML_FORM
                        <br/>性别 &nbsp;
\t\t\t\t\t\t女<input type="radio" name="gender" value="1" checked="checked"/>
Example #6
0
<?php

require "includes/admin_header.php";
?>

<?php 
require_once "../database/users_functions.php";
?>
  

<?php 
/** GET USER INFORMATION **/
// Used to fill all the camps with the current data
if (isset($_GET['user_id'])) {
    $user = findUserById($_GET['user_id']);
} else {
    $username = $_SESSION['user']['username'];
    $user = findUserByUsername($username);
}
/** UPDATE USER **/
if (isset($_POST['submit_edit_user'])) {
    $user['email'] = $_POST['user_email'];
    $user['first_name'] = $_POST['user_first_name'];
    $user['last_name'] = $_POST['user_last_name'];
    $user['role'] = $_POST['user_role'];
    $current_user_password = $_POST['user_current_password'];
    $new_user_password = $_POST['user_password'];
    $new_user_password_check = $_POST['user_password_check'];
    $new_user_image = $_FILES['user_image']['name'];
    $new_user_image_tmp = $_FILES['user_image']['tmp_name'];
    if (!empty($new_user_image)) {
Example #7
0
     filterUser();
     break;
 case 'comUser':
     //查询企业用户
     comUser();
     break;
 case 'jobUser':
     //查询兼职用户
     jobUser();
     break;
 case 'addComUser':
     //添加企业用户
     addComUser();
     break;
 case 'findUserById':
     findUserById();
     break;
 case 'editComUser':
     editComUser();
     break;
 case 'addJobUser':
     //添加兼职用户
     addJobUser();
     break;
 case 'editJobUser':
     //编辑兼职用户
     editJobUser();
     break;
 case 'editUserStatus':
     //更改用户状态,包括兼职用户和企业用户
     editUserStatus();