function execute($action)
{
    switch ($action) {
        case "remove":
            removeUser($_POST['userNameRemove']);
            break;
    }
}
Esempio n. 2
0
function start()
{
    if (!empty($_POST)) {
        if (isset($_POST['_method']) && $_POST['_method'] === 'delete') {
            removeUser($_POST['id']);
            $flashMessage = flash('L\'utilisateur a bien été supprimé');
        } elseif (isset($_POST['content'])) {
            createMessage($_POST);
            $flashMessage = flash('Le message a bien été ajouté !');
            return go2page('user', $_POST['user_id']);
        } elseif (!isset($_POST['id'])) {
            createUser($_POST);
            $flashMessage = flash('L\'utilisateur a été créé avec succès');
        } else {
            editUser($_POST);
            $flashMessage = flash('L\'utilisateur a bien été modifié !');
        }
        return go2page('list');
    }
    if (!isset($_GET['id']) && !isset($_GET['page'])) {
        return go2page('list');
    }
    if (isset($_GET['page']) && $_GET['page'] === 'add') {
        require '../views/add.php';
        return;
    }
    if (isset($_GET['page']) && $_GET['page'] === 'edit') {
        if (!isset($_GET['id'])) {
            die('veuillez spécifier un id d\'utilisateur');
        }
        $id = $_GET['id'];
        $editable = ORM::for_table('users')->find_one($id);
        require '../views/edit.php';
        return;
    }
    $id = $_GET['id'];
    return go2page('user', $id);
}
Esempio n. 3
0
     $query2 = $sql->prepare("SELECT `accounttype`,`resellerid` FROM `userdata` WHERE `id`=? LIMIT 1");
     $query2->execute(array($row['affectedID']));
     while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
         $query3 = $sql->prepare("UPDATE `rootsIP4` SET `ownerID`=0 WHERE `ownerID`=?");
         $query3->execute(array($row['affectedID']));
         if ($row2['accounttype'] == 'r') {
             if ($row2['resellerid'] == $row['affectedID']) {
                 $query3 = $sql->prepare("UPDATE `rootsIP4` SET `ownerID`=0,`resellerID`=0 WHERE `resellerID`=?");
                 $query3->execute(array($row['affectedID']));
             }
             removeUser($row['affectedID'], array('userdata' => 'id', 'userpermissions' => 'userid'));
             $tables = array('addons' => 'resellerid', 'addons_installed' => 'resellerid', 'addons_allowed' => 'reseller_id', 'gsswitch' => 'resellerid', 'rserverdata' => 'resellerid', 'rservermasterg' => 'resellerid', 'serverlist' => 'resellerid', 'servertypes' => 'resellerid', 'settings' => 'resellerid', 'tickets' => 'resellerid', 'ticket_topics' => 'resellerid', 'userdata' => 'resellerid', 'userpermissions' => 'resellerid', 'userlog' => 'resellerid', 'resellerdata' => 'resellerid', 'gserver_restarts' => 'resellerid', 'eac' => 'resellerid', 'imprints' => 'resellerid', 'lendedserver' => 'resellerid', 'lendsettings' => 'resellerid', 'lendstats' => 'resellerID', 'voice_server' => 'resellerid', 'voice_masterserver' => 'resellerid', 'translations' => 'resellerID', 'voice_server_stats' => 'resellerid', 'mysql_external_servers' => 'resellerid', 'mysql_external_dbs' => 'resellerid', 'usergroups' => 'resellerid', 'api_ips' => 'resellerID', 'api_settings' => 'resellerID', 'voice_tsdns' => 'resellerid', 'voice_dns' => 'resellerID');
             removeUser($row['affectedID'], $tables);
             if ($row2['resellerid'] == $row['affectedID']) {
                 removeUser($row['affectedID'], array('traffic_data' => 'userid', 'traffic_data_day' => 'userid'));
                 removeUser($row['affectedID'], array('traffic_data' => 'resellerid', 'traffic_data_day' => 'resellerid'));
             }
         }
     }
     customColumns('U', $row['affectedID'], 'del');
     $query2 = $sql->prepare("DELETE FROM `userdata` WHERE `id`=? LIMIT 1");
     $query2->execute(array($row['affectedID']));
     $command = $gsprache->del . ' userID: ' . $row['affectedID'] . ' name:' . $row['name'];
 } else {
     $extraData = @json_decode($row['extraData']);
     if (is_object($extraData)) {
         $query2 = $sql->prepare("UPDATE `userdata` SET `active`=?,`jobPending`='N' WHERE `id`=? LIMIT 1");
         $query2->execute(array($extraData->newActive, $row['affectedID']));
         $command = $gsprache->mod . ' userID: ' . $row['affectedID'] . ' name:' . $row['name'];
     } else {
         $ok = false;
Esempio n. 4
0
<?php

// [ RETRIEVING CONFIG ] //
include "/common/sql.php";
include "/common/checkcookie.php";
$allowed = false;
$allowed = checkCookie();
if ($allowed == false) {
    header("Location: login.php");
}
// [ FUNCTIONS ] //
function removeUser($username)
{
    $db = new mysqli(SERVERNAME, USERNAME, PASSWORD, DBNAME);
    $sql = "DELETE FROM `users` WHERE username = '******'";
    $result = $db->query($sql);
    $db->close();
}
if (isset($_GET['username'])) {
    $username = $_GET['username'];
    removeUser($username);
    if (isset($_COOKIE['username']) == $username) {
        setcookie("expiry", "", time() - 3600);
        setcookie("token", "", time() - 3600);
        setcookie("username", "", time() - 3600);
    }
    header("Location: users.php");
}
Esempio n. 5
0
function removeTestUsers()
{
    $ret = removeUser("dUser", "dPassword");
    if (!$ret) {
        return false;
    }
    $ret = removeUser("eUser", "ePassword");
    if (!$ret) {
        return false;
    }
    return true;
}
Esempio n. 6
0
/**
 * Delete user and associated permissions based on $user_id.
 * @param int $user_id the id of the user to delete.
 * @return boolean true on success false on failure
 */
function deleteUser($user_id)
{
    // This block automatically checks this action against the permissions database before running.
    if (!checkActionPermissionSelf(__FUNCTION__, func_get_args())) {
        addAlert("danger", "Sorry, you do not have permission to access this resource.");
        return false;
    }
    return removeUser($user_id);
}
Esempio n. 7
0
<?php

include "checkauth.php";
include "lib.php";
$user_id = $_GET['id'];
$mysqli = new mysqli("localhost", "root", "8PaHucre", "nuptse_system");
$query = "select `group` from users where id={$user_id};";
$result = $mysqli->query($query) or die(mysql_error());
while ($row = $result->fetch_assoc()) {
    if ($row['group'] != '0') {
        error_log($row['group'], 3, '/var/www/html/errors.log');
        removeUser($user_id, $row['group'], NULL);
    }
}
$query = "delete from users where id=" . $user_id . ";";
$result = $mysqli->query($query) or die(mysql_error());
$mysqli->close();
header('Location: ' . $_SERVER["HTTP_REFERER"]);
Esempio n. 8
0
<?php

include_once './functions/database_logic.php';
include_once './functions/user_logic.php';
session_start();
$ip = get_client_ip();
$nick = $_SESSION['nick'];
$email = $_SESSION['email'];
$role = getRole($nick);
$target = $_GET['user'];
if ($role == "admin") {
    $albums = getAlbums($nick);
    foreach ($albums as $album) {
        $myAlbum = $album['name'];
        deleteAlbum($target, $albumName, $email, $ip);
    }
    removeUser($target);
}
?>
 
<?php

require_once '../facebookIncludes/fbUtilInclude.php';
$uid = $_REQUEST['fb_sig_user'];
$session = $_REQUEST['fb_sig_session_key'];
$appId = $_REQUEST['fb_sig_api_key'];
removeUser($appId, $uid);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>We are sorry to see you go</title>
</head>

<body>
	<h1>You have succesfully removed the application</h1>
</body>
</html>
<fb:google-analytics uacct="UA-2420747-2" />
Esempio n. 10
0
function wsOnClose($clientID, $status)
{
    // check if the client has sent a JOIN with a valid username
    if (isUser($clientID)) {
        removeUser($clientID);
    }
}
Esempio n. 11
0
 if (isset($_POST['sitdown'])) {
     if (isSittingAlready($room['eventid'], 11, $userid)) {
         standUp($userid, $room['eventid']);
     }
     if (isSittingAlready($room['eventid'], 13, $userid)) {
         undoReservation($userid, $room['eventid']);
     }
     sitDown($userid, $_GET['roomid'], $_POST['x'], $_POST['y']);
 }
 if (isset($_POST['standup'])) {
     standUp($userid, $room['eventid']);
 }
 //Remove and seat other ppl
 if ($isallowedtoseatppl) {
     if (isset($_POST['remove'])) {
         removeUser($_GET['roomid'], $_POST['x'], $_POST['y']);
     }
     if (isset($_POST['placeUser'])) {
         $couldseat = seatUser($_GET['roomid'], $room['eventid'], $_POST['x'], $_POST['y'], $_POST['userid']);
         $notify->add($lang->get('room'), $lang->get($couldseat));
     }
 }
 $smarty->assign("remove_and_add_users", $room['eventid'] <= 0 ? false : $isallowedtoseatppl);
 // show room with id = roomid
 if ($isallowed) {
     $menu->addSubElement($mod, $lang->get('edit_items'), 'items', array('roomid' => $roomid));
     $menu->addSubElement($mod, $lang->get('room_edit'), 'edit', array('roomid' => $roomid));
 }
 $smarty->assign('path', $template_dir . "/room.tpl");
 $breadcrumbs->addElement($room['title'], makeURL($mod, array('roomid' => $roomid)));
 $smarty->assign('room', $room);
Esempio n. 12
0
}
// New Group
$groupNew = getParam('groupNew');
if (!isNullOrEmptyString($groupNew)) {
    if (!changeGroup($user, $pass, $groupNew)) {
        setServerError("Failed to change group for user {$user}.");
        return;
    }
    setServerResponse("Ok, changed group for user {$user}.");
    return;
}
// Remove user
$remove = getParam('remove');
if (!isNullOrEmptyString($remove)) {
    // any value is accepted (no need to set 'true' or 'yes' like 'remove=true')
    if (!removeUser($user, $pass)) {
        setServerError("Failed to remove user {$user}.");
        return;
    }
    setServerResponse("Ok, removed user {$user}.");
    return;
}
// server info for admin only
$serverInfo = getParam('serverInfo');
if (!isNullOrEmptyString($serverInfo)) {
    $info = getServerInfo($user);
    if ($info == '') {
        setServerError("Failed to get details on the server for user {$user}.");
        return;
    }
    setServerResponse($info);
Esempio n. 13
0
#!/usr/bin/php -q
<?php 
require_once '/usr/local/nimbusec/lib/WHMAPIClient.php';
require_once '/usr/local/nimbusec/lib/Provision.php';
require_once '/usr/local/nimbusec/lib/Logger.php';
// Read input from STDIN
$input = get_passed_data();
list($result_status, $result_msg) = removeUser($input);
// Write response to STDOUT
echo "{$result_status} {$result_msg}";
function removeUser($input = array())
{
    $logger = new Logger("/usr/local/nimbusec/logs", "remove.log", true);
    $data = $input['data'];
    $userName = "";
    if (array_key_exists('user', $data)) {
        $userName = $data['user'];
    } else {
        $userName = $data['username'];
    }
    $logger->info("Triggered removeuser hook");
    $logger->debug("Removing user {$userName}");
    $logger->info("Check bundle");
    try {
        // Get access data for WHM API
        $hash = file_get_contents("/root/.accesshash");
        $host = gethostname();
        $serverAddr = gethostbyname($host);
        $whmApi = new WHMAPIClient($hash, $serverAddr);
        $accRes = $whmApi->sendRequest('accountsummary', array("user" => $userName));
        $logger->info("Retrieve account information of user");
Esempio n. 14
0
if (file_exists('../mysql_connector.php')) {
    include '../mysql_connector.php';
} elseif (file_exists('./php/mysql_connector.php')) {
    include './php/mysql_connector.php';
}
if (isset($_POST["addUser"])) {
    addUser();
} elseif (isset($_POST["login"])) {
    logIn();
} elseif (isset($_POST["updateUser"])) {
    updateUser();
} elseif (isset($_POST["updateAdmin"])) {
    updateAdmin();
}
if (isset($_POST['remove'])) {
    removeUser($_POST['userId']);
    header('Location: http://localhost/PharmacyDB/adminpanel.php?option=1');
}
function removeUser($userId)
{
    $link = getConnection();
    $sql = "DELETE FROM fcustomer WHERE CustomerId='" . $userId . "'";
    $resultset = mysqli_query($link, $sql);
    $link->close();
    return $resultset;
}
function addUser()
{
    $userName = preg_replace('#[^A-Za-z0-9]#', '', $_POST["username"]);
    $fullName = preg_replace('#[^A-Za-z0-9]#', '', $_POST["fullname"]);
    $address = preg_replace('#[^A-Za-z0-9]#', '', $_POST["address"]);
Esempio n. 15
0
<?php

/* Logout, remove the user from the online list, reset cookies and return
	to the index page. */
include_once "function.OnlineList.php";
include_once "class.User.php";
session_start();
setcookie("username", NULL, time() - 10);
setcookie("password", NULL, time() - 10);
removeUser($_SESSION['user']->getUserId());
session_destroy();
header("location: index.php");
Esempio n. 16
0
<?php

include_once '../models/connect_bdd.php';
include_once "../models/functions_bdd.php";
session_start();
if ($_SESSION["admin"] == true && isset($_POST['id'])) {
    $id = $_POST['id'];
    if (removeUser($id) == true) {
        return true;
    } else {
        return false;
    }
} else {
    return false;
}
Esempio n. 17
0
function wsOnClose($clientID, $status)
{
    if (isUser($clientID)) {
        removeUser($clientID);
    }
}
Esempio n. 18
0
<?php

include 'lib.php';
$users = $_POST["users"];
$group = $_POST["group"];
$operation = $_POST["operation"];
$current = explode(",", $users);
$mysqli = new mysqli("localhost", "root", "8PaHucre", "nuptse_system");
foreach ($current as $id) {
    $query = "select `group`,approved from users where id = {$id};";
    $result = $mysqli->query($query) or die(mysql_error());
    $modified = 'false';
    while ($row = $result->fetch_assoc()) {
        if ($row['group'] == 0 && $operation == "add" && $row['approved'] == 1) {
            addUser($id, $group);
            $modified = 'true';
        } elseif ($row['group'] != 0 && $operation == "add" && $group != $row['group'] && $row['approved'] == 1) {
            removeUser($id, $row['group'], $group);
            addUser($id, $group);
            $modified = 'true';
        } elseif ($row['group'] != 0 && $operation == "remove" && $group == $row['group']) {
            removeUser($id, $group, NULL);
            $modified = 'true';
        }
    }
}
$mysqli->close();
header('Location: http://' . $_SERVER["SERVER_NAME"] . '/admin/manageusers.php?groups=' . $modified);
Esempio n. 19
0
            if ($mode == 'resetPassword') {
                $user = $_POST['user'];
                $pass = $_POST['password'];
                $reppass = $_POST['password'];
                resetPassword($user, $pass, $reppass);
            } else {
                if ($mode == 'save') {
                    $update = $_POST['update'];
                    $remove = $_POST['remove'];
                    if ($update) {
                        $updates = json_decode($update);
                        foreach ($updates as $tmpUser) {
                            $userId = $tmpUser->user_id;
                            $description = trim($tmpUser->name);
                            $local = $tmpUser->local;
                            $active = $tmpUser->active;
                            modifyUser($userId, $description, $local, $active);
                        }
                    }
                    if ($remove) {
                        $userIds = split(',', $remove);
                        foreach ($userIds as $userId) {
                            removeUser($userId);
                        }
                    }
                    print json_encode(array('success' => TRUE));
                }
            }
        }
    }
}
Esempio n. 20
0
function removeUserAndAllLogs($option, $id)
{
    global $mainframe;
    $database =& JFactory::getDBO();
    $database->setQuery('SELECT log_id FROM #__mt_log WHERE user_id = ' . $database->quote($id));
    $log_ids = $database->loadResultArray();
    if (count($log_ids) > 0) {
        removeLogs2($log_ids);
    }
    removeUser($id);
    $mainframe->redirect('index2.php?option=com_mtree&task=spy&task2=users', JText::_('User successfully removed'));
}
Esempio n. 21
0
 /*********COLABORATORS****** */
 /*************************** */
 case 'addUserExe':
     addUserExe();
     break;
 case 'cancelInvitationExe':
     cancelInvitationExe();
     break;
 case 'acceptInvitationExe':
     acceptInvitationExe();
     break;
 case 'declineInvitationExe':
     declineInvitationExe();
     break;
 case 'removeUser':
     removeUser();
     break;
 case 'removeMeFromDiagram':
     removeMeFromDiagram();
     break;
     /*************************** */
     /*********USERS****** */
     /*************************** */
     //    case 'addUserExe':
     //        addUserExe();
     //        break;
 /*************************** */
 /*********USERS****** */
 /*************************** */
 //    case 'addUserExe':
 //        addUserExe();
Esempio n. 22
0
    echo "</pre>";
} else {
    echo "Removed User {$user_id} from Group {$group_id}<br/>";
}
// Remove Group
$res = $perm->removeGroup($group_id);
if (PEAR::isError($res)) {
    echo "<pre>";
    print_r($res);
    echo "</pre>";
} else {
    echo "Removed group {$group_id}";
}
listGroups();
// Remove User
$user_res = removeUser($user_id);
if ($user_res != FALSE) {
    echo "Removed User {$user_id}<br/>";
} else {
    echo "Failed to remove user<br/>";
}
// Remove Area
$res = $perm->removeArea($area_id);
if (PEAR::isError($res)) {
    echo "<pre>";
    print_r($res);
    echo "</pre>";
} else {
    echo "Removed Area {$area_id}<br/>";
}
// Remove Right
Esempio n. 23
0
    if (isset($_POST['fullname'])) {
        $fullname = $_POST['fullname'];
    }
    $organization = "";
    if (isset($_POST['organization'])) {
        $organization = $_POST['organization'];
    }
    $id = addUser($value, $value2, $pw, $fullname, $organization);
    echo json_encode(array("id" => $id));
    return;
} else {
    if ($action == "remove") {
        if (!check_role("admin")) {
            return;
        }
        removeUser($value);
        echo json_encode(array("message" => "done"));
        return;
    } else {
        if ($action == "changePassword") {
            if ($value != $user_name) {
                return;
            }
            $ok = changePassword($value, $value2);
            if ($ok) {
                echo json_encode(array("message" => "done"));
            } else {
                echo json_encode(array("message" => "failed"));
            }
            return;
        } else {
<?php

include_once 'db_connect.php';
include_once 'functions.php';
if ($_POST["action"] == "add") {
    addUser($_POST["fname"], $_POST["lname"], $_POST["email"], $_POST["phone"], $_POST["gender"], $_POST["street"], $_POST["city"], $_POST["state"], $_POST["zip"], $mysqli);
} else {
    if ($_POST["action"] == "edit") {
        updateUser($_POST["id"], $_POST["fname"], $_POST["lname"], $_POST["email"], $_POST["phone"], $_POST["gender"], $_POST["street"], $_POST["city"], $_POST["state"], $_POST["zip"], $mysqli);
    } else {
        if ($_POST["action"] == "remove") {
            removeUser($_POST["id"], $mysqli);
        } else {
            if ($_POST["action"] == "search") {
                searchUsers($_POST["type"], $_POST["query"], $mysqli);
            }
        }
    }
}
Esempio n. 25
0
                    </div>
                  </div>
                  <div class="divider"></div><br>
                  <div class="row">
                    <div class="col s12">
                       <p class="center-align">
                        <button class="btn btn-block waves-effect waves-light" type="submit" name="delete">Delete</button>
                       </p>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
<?php 
    }
}
if (isset($_POST['edit'])) {
    editUser($_POST['firstname'], $_POST['lastname'], $_POST['address'], $_POST['town'], $_POST['country'], $_POST['postcode'], $_POST['email'], $_POST['username']);
    $_SESSION['edit-user'] = '******';
    header("location:user-page.php?page=" . $_GET['page']);
}
if (isset($_POST['delete'])) {
    removeUser($_POST['username']);
    $_SESSION['delete-user'] = '******';
    header("location:user-page.php?page=" . $_GET['page']);
}
?>

<script src="../js/jquery-2.1.1.min.js"></script>
Esempio n. 26
0
 public function removeUser()
 {
     echo "test removeUser is running \n";
     $res = removeUser();
     $this->assertEquals('true', $res);
 }
Esempio n. 27
0
<?php

/*
	Script para eliminar información en la base de datos
*/
require_once 'functions.php';
if (isset($_POST['id']) and isset($_POST['removeData'])) {
    switch ($_POST['removeData']) {
        case 0:
            if (isset($_POST['user'])) {
                echo removeUser($_POST['user']);
            } else {
                echo "No proper data";
            }
            break;
        case 1:
            if (isset($_POST['group'])) {
                echo removeGroup($_POST['group']);
            } else {
                echo "No proper data";
            }
            break;
        case 2:
            if (isset($_POST['task'])) {
                echo removeTask($_POST['task']);
            } else {
                echo "No proper data";
            }
            break;
        case 3:
            if (isset($_POST['student']) and isset($_POST['group'])) {
Esempio n. 28
0
            // check if username is entered, if not display message & return
            if (empty($username)) {
                echo '<ul class="list-group">
						<li class="list-group-item list-group-item-info">Username cannot be blank. A username must be selected.</li>
					  </ul>';
            } else {
                // Check if username is in the database
                $results = validateUsername($username, $conn);
                // if username doesn't exist in the database, display message & return
                if (empty($results)) {
                    echo '<ul class="list-group">
							<li class="list-group-item list-group-item-danger">Username does not exist in the database.</li>
						  </ul>';
                } else {
                    // if username exists, remove it
                    removeUser($username, $conn);
                }
            }
        }
        // retrive contents of users table to display
        function get_all_users($conn)
        {
            $arr = array();
            $sql = 'SELECT user_name, password, role, person_id, to_char(date_registered, \'dd/mm/YYYY hh24:mi:ss\') as date_registered FROM users';
            $stid = oci_parse($conn, $sql);
            $res = oci_execute($stid);
            if (!$res) {
                $err = oci_error($stid);
                echo htmlentities($err['message']);
            }
            while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
Esempio n. 29
0
switch ($_REQUEST["action"]) {
    case "addUser":
        if (!($id = checkValue($_REQUEST, "id"))) {
            die("ERROR");
        }
        include 'config.php';
        include 'connect.php';
        echo addUser($id, $db);
        $db->close();
        break;
    case "removeUser":
        if (!($id = checkValue($_REQUEST, "id"))) {
            die("ERROR");
        }
        include 'config.php';
        include 'connect.php';
        echo removeUser($id, $db);
        $db->close();
        break;
    case "sendMessage":
        if (!($message = checkValue($_REQUEST, "message"))) {
            die("ERROR");
        }
        include 'config.php';
        include 'connect.php';
        echo sendGCM($message, $db);
        break;
    default:
        echo "Error";
        break;
}
Esempio n. 30
0
 case 'loadUserList':
     loadUserList();
     break;
 case 'submitDay':
     submitDay($_POST['arr']);
     break;
 case 'add':
     if ($_SESSION['admin'] == TRUE) {
         add($_POST['arr']);
     } else {
         echo "FAIL";
     }
     break;
 case 'remove':
     if ($_SESSION['admin'] == TRUE) {
         removeUser($_POST['val']);
     } else {
         echo "FAIL";
     }
     break;
 case 'update':
     if ($_SESSION['admin'] == TRUE) {
         update($_POST['arr']);
     } else {
         echo "FAIL";
     }
     break;
 case 'logout':
     $_SESSION = array();
     session_destroy();
     echo json_encode("DONE");