PHP Method User::Delete, codiad Code Examples

This page contains top rated real world PHP examples of method User::Delete from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples

Delete() public method

public Delete ( )
Example #1
Show file File: TestTemplate.php Project: rakesh-mohanta/icehrm
0
 protected function deleteAllUsers()
 {
     $user = new User();
     $users = $user->Find("username <> ?", array('admin'));
     foreach ($users as $user) {
         $user->Delete();
     }
 }
Example #2
Show file File: userController.php Project: csebubt/news
0
 public function Delete()
 {
     global $obj, $model, $param1;
     include_once 'Model/user.php';
     $model = new User();
     $model->Id = $param1;
     if ($model->Delete()) {
         print '<span class="success">User Updated</span>';
     } else {
         print '<span class="error">' . $model->Error . '</span>';
     }
     include_once 'View/User/index.php';
 }
Example #3
Show file File: controller.php Project: mirzavu/clothfarm
0
        }
        $User->username = User::CleanUsername($_POST['username']);
        $User->password = $_POST['password'];
        $User->Create();
    }
}
//////////////////////////////////////////////////////////////////
// Delete User
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'delete') {
    if (checkAccess()) {
        if (!isset($_GET['username'])) {
            die(formatJSEND("error", "Missing username"));
        }
        $User->username = $_GET['username'];
        $User->Delete();
    }
}
//////////////////////////////////////////////////////////////////
// Set Project Access
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'project_access') {
    if (checkAccess()) {
        if (!isset($_GET['username'])) {
            die(formatJSEND("error", "Missing username"));
        }
        $User->username = $_GET['username'];
        //No project selected
        if (isset($_POST['projects'])) {
            $User->projects = $_POST['projects'];
        } else {
Example #4
Show file File: UserHelper.php Project: GeraldScott/OpenEvSys
0
 public static function deleteUserId($username)
 {
     $user = new User();
     return $user->Delete('username', $username);
 }
Example #5
Show file File: users.php Project: rumi55/openbulksms
0
 public function delete($loginId)
 {
     $requestIsAutheticated = $this->requestIsAutheticated();
     $user = $this->checkLogin('enekpani');
     //deleting account
     if (!empty($loginId)) {
         $user2d = new User($loginId);
         $user2d->Delete();
         $notification = 'Accout Deleted';
     }
     header('Location: ' . URL . 'users?notification=' . $notification . '&error_code=1');
     exit;
 }
Example #6
Show file File: ajax.php Project: jobsbe7/PokeDev
0
         break;
     case 'admin_edit':
         $user = new User();
         $user->Load(array('id' => $_POST['user_id']));
         $user->ChangeSettings($_POST);
         $success = Error::HasErrors() ? false : true;
         if (!empty($_POST['password']) || !empty($_POST['cpassword'])) {
             $success = $success && $user->ChangePassword($_POST);
         }
         $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
         $data = array('email' => $user->Get('email'), 'username' => $user->Get('username'));
         break;
     case 'admin_delete':
         $user = new User();
         if ($user->Load(array('id' => $_POST['user_id']))) {
             $success = $user->Delete();
         } else {
             Error::Set('user', 'usernotfound');
         }
         $message = $success ? array(Config::Get('success.saved')) : Error::GetAll();
         break;
     case 'admin_compose':
         $validator = new Validate();
         $success = $validator->AddValue('email', $_POST['email'])->AddPattern('email')->Check();
         $success = $success && Email::SendEmail($_POST['email'], $_POST['subject'], $_POST['message']);
         $message = $success ? array(Config::Get('success.sent')) : Error::GetAll();
         break;
     default:
         $message = array(Config::Get('unexpectederror'));
         break;
 }
Example #7
Show file File: deleteUserimple.php Project: phuongktax/sosad
0
<?php

include 'configs/configs.php';
if (isset($_POST['delete'])) {
    $multi = $_POST['multidelete'];
    $newUser = new User();
    $newUser->multi = $multi;
    $newUser->Delete();
    header('location: manageuser.php');
}
Example #8
Show file File: users.php Project: andersoonluan/PHP
0
<?php

include 'core/init.php';
$user = new User();
$template = new Template();
if (!$user->HasPermission("admin")) {
    Redirect::To(404);
}
if (Input::get("delete") && $user->hasPermission("admin") && Input::get("checkbox")) {
    try {
        foreach (Input::get("checkbox") as $checkbox) {
            $user->Delete($checkbox);
        }
        Session::Flash("usersPage", "success", lang('USERS_ACCOUNT_DELETED_SUCCESS'), true);
    } catch (Exception $ex) {
        Session::Flash("usersPage", "danger", $ex->GetMessage(), true);
    }
}
if (Input::get("action") == "delete" && Input::get("userId") && $user->hasPermission("admin")) {
    try {
        $user->Delete(Input::get("userId"));
        Session::Flash("usersPage", "success", lang('USER_ACCOUNT_DELETED_SUCCESS'), true);
    } catch (Exception $ex) {
        Session::Flash("usersPage", "danger", $ex->GetMessage(), true);
    }
    Redirect::To("users.php");
}
if (Input::get("activate") && $user->hasPermission("admin") && Input::get("checkbox")) {
    try {
        foreach (Input::get("checkbox") as $checkbox) {
            $user->activate($checkbox);
        }
Example #9
Show file File: user_view.php Project: laiello/candydolldb
0
         $User->setSalt($NewSalt);
         $User->setPassword(Utils::HashString($_POST['txtPassword'], $NewSalt));
     } else {
         $PasswordError = TRUE;
     }
 }
 if ($_POST['txtBirthDate'] && $_POST['txtBirthDate'] != 'YYYY-MM-DD' && strtotime($_POST['txtBirthDate']) !== FALSE) {
     $User->setBirthDate(strtotime($_POST['txtBirthDate']));
 } else {
     $User->setBirthDate(-1);
 }
 if (!$PasswordError || $DeleteUser) {
     if (Utils::ValidateEmail($User->getEmailAddress()) || $DeleteUser) {
         if ($User->getID()) {
             if ($DeleteUser) {
                 if (User::Delete($User, $CurrentUser)) {
                     session_regenerate_id(TRUE);
                     header('location:user.php');
                     exit;
                 }
             } else {
                 if (User::Update($User, $CurrentUser)) {
                     if ($User->getID() == $CurrentUser->getID()) {
                         $_SESSION['CurrentUser'] = serialize($User);
                     }
                     session_regenerate_id(TRUE);
                     header('location:user.php');
                     exit;
                 }
             }
         } else {
Example #10
Show file File: adminModule.class.php Project: GeraldScott/OpenEvSys
0
 public function act_delete_user()
 {
     //$this->set_event();
     if (isset($_POST['no'])) {
         set_redirect_header('admin', 'user_management');
         return;
     }
     if (!isset($_POST['users'])) {
         shnMessageQueue::addInformation(_t('PLEASE_SELECT_A_USER_TO_DELETE'));
         set_redirect_header('admin', 'user_management');
         exit;
     }
     $this->del_confirm = true;
     if (isset($_POST['yes'])) {
         if (isset($_POST['user'])) {
             array_push($_POST['users'], $_POST['user']);
         }
         //if multiplt users are selected
         if (is_array($_POST['users'])) {
             foreach ($_POST['users'] as $user) {
                 if ($user == 'admin') {
                     shnMessageQueue::addInformation(_t('YOU_CANNOT_DELETE_THE_ADMINISTRATOR_ACCOUNT_'));
                     continue;
                 }
                 if ($user == $_SESSION['username']) {
                     shnMessageQueue::addInformation(_t('YOU_CANNOT_DELETE_YOURSELF_FROM_THE_LIST_OF_USERS_'));
                     continue;
                 }
                 if (key(acl_get_user_roles($user)) == 'admin' && $_SESSION['username'] != 'admin') {
                     shnMessageQueue::addInformation(_t('YOU_CANNOT_DELETE_OTHER_ADMIN_USERS_'));
                     continue;
                 }
                 $u = new User();
                 $up = new UserProfile();
                 $up->Delete('username', $user);
                 $u->Delete('username', $user);
                 acl_delete_user($user);
             }
         }
         set_redirect_header('admin', 'user_management');
         return;
     }
     //if there are multiple evets show table
     $this->users = Browse::getUserListArray($_POST['users']);
 }
Example #11
Show file File: members.php Project: KmServer/CumulusClips
0
App::LoadClass('Flag');
App::LoadClass('Pagination');
// Establish page variables, objects, arrays, etc
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
$records_per_page = 9;
$url = ADMIN . '/members.php';
$query_string = array();
$message = null;
$sub_header = null;
### Handle "Delete" member
if (!empty($_GET['delete']) && is_numeric($_GET['delete'])) {
    // Validate id
    if (User::Exist(array('user_id' => $_GET['delete']))) {
        User::Delete($_GET['delete']);
        $message = 'Member has been deleted';
        $message_type = 'success';
    }
} else {
    if (!empty($_GET['activate']) && is_numeric($_GET['activate'])) {
        // Validate id
        $user = new User($_GET['activate']);
        if ($user->found) {
            $user->UpdateContentStatus('active');
            $user->Approve('approve');
            $message = 'Member has been activated';
            $message_type = 'success';
        }
    } else {
        if (!empty($_GET['unban']) && is_numeric($_GET['unban'])) {
Example #12
Show file File: pgUser.php Project: googlecode-mirror/schifers
0
            $message = "Senhas não conferem.";
        } else {
            if ($user->Update()) {
                $message = $screen_module_name . " alterado com sucesso.";
                $user_password1 = "";
                $user_password2 = "";
            } else {
                $message = "Problemas na operação.";
            }
        }
    }
    if ($action == 4) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetId($user_id);
        if ($user->Delete()) {
            $message = $screen_module_name . " excluído com sucesso.";
            $user_id = "";
            $user_username = "";
            $user_password1 = "";
            $user_password2 = "";
            $user_active = "";
        } else {
            $message = "Problemas na operação.";
        }
    }
}
?>

<html>
	<head>
Example #13
Show file File: user.class.php Project: qexyorg/webMCR-1
0
 public function Delete()
 {
     global $bd_names;
     if (!$this->id) {
         return false;
     }
     if ($this->IsSystem()) {
         return false;
     }
     $result = getDB()->ask("SELECT `id` FROM `{$bd_names['users']}` " . "WHERE `group`='" . $this->id . "'");
     if ($result) {
         while ($line = $result->fetch('num')) {
             $user_del = new User($line[0]);
             $user_del->Delete();
             unset($user_del);
         }
     }
     $result = getDB()->ask("DELETE FROM `{$this->db}` WHERE `id` = '" . $this->id . "' AND `system` = '0'");
     $this->id = false;
     if ($result and $result->rowCount()) {
         return true;
     }
     return false;
 }
Example #14
Show file File: user_edit.php Project: polaris610/track_software
0
<?php

require 'include/config.php';
require 'include/class.user.php';
$user = new User($db);
if (isset($_POST['submitedit'])) {
    $user->Edit($_POST);
    Misc::Redirect('user_list.php');
}
if (isset($_POST['submitdelete'])) {
    $user->Delete($_POST['id']);
    Misc::Redirect('user_list.php');
}
$u = $user->getUser($_GET['id']);
include 'include/top.php';
?>

<form method="post">
	<input type="hidden" name="id" value="<?php 
echo $_GET['id'];
?>
" />
	<p>
		<label><span>Name</span></label>
		<input type="text" name="name" id="name" placeholder="Enter user's name" value="<?php 
echo $u['name'];
?>
"  />
	</p>
	<p>
		<label><span>E-mail</span></label>
Example #15
Show file File: utility_sql_worker.php Project: Gerold103/lgmis
0
 //if action is deleting
 if (isset($_POST['type'])) {
     if (isset($_POST['id'])) {
         $title = Language::Word('deleting result');
         $header = $title;
         $content = '';
         switch ($_POST['type']) {
             case RequestOnRegister::$type:
                 if (!RequestOnRegister::Delete($_POST['id'])) {
                     $content = AlertMessage('alert-danger', Language::Word('error while request rejecting'));
                 } else {
                     $content = AlertMessage('alert-success', Language::Word('request is rejected'));
                 }
                 break;
             case User::$type:
                 if (!User::Delete($_POST['id'])) {
                     $content = AlertMessage('alert-danger', Language::Word('error while user deleting'));
                 } else {
                     $content = AlertMessage('alert-success', Language::Word('user is deleted'));
                 }
                 break;
             case Article::$type:
                 if (!Article::Delete($_POST['id'])) {
                     $content = AlertMessage('alert-danger', Language::Word('error while article deleting'));
                 } else {
                     $content = AlertMessage('alert-success', Language::Word('article is deleted'));
                 }
                 break;
             case Report::$type:
                 $tmp = Report::Delete($_POST['id']);
                 if (Error::IsError($tmp)) {
Example #16
Show file File: manageUsers.php Project: kitware/cdash
0
        }
    } elseif (isset($_POST['makenormaluser'])) {
        if ($postuserid > 1) {
            $update_array = pdo_fetch_array(pdo_query('SELECT firstname,lastname FROM ' . qid('user') . " WHERE id='" . $postuserid . "'"));
            pdo_query('UPDATE ' . qid('user') . " SET admin=0 WHERE id='" . $postuserid . "'");
            $xml .= '<warning>' . $update_array['firstname'] . ' ' . $update_array['lastname'] . ' is not administrator anymore.</warning>';
        } else {
            $xml .= '<error>Administrator should remain admin.</error>';
        }
    } elseif (isset($_POST['makeadmin'])) {
        $update_array = pdo_fetch_array(pdo_query('SELECT firstname,lastname FROM ' . qid('user') . " WHERE id='" . $postuserid . "'"));
        pdo_query('UPDATE ' . qid('user') . " SET admin=1 WHERE id='" . $postuserid . "'");
        $xml .= '<warning>' . $update_array['firstname'] . ' ' . $update_array['lastname'] . ' is now an administrator.</warning>';
    } elseif (isset($_POST['removeuser'])) {
        $user = new User();
        $user->Id = $postuserid;
        $user->Fill();
        $name = $user->GetName();
        $user->Delete();
        $xml .= "<warning>{$name} has been removed.</warning>";
    }
    if (isset($_POST['search'])) {
        $xml .= '<search>' . $_POST['search'] . '</search>';
    }
    if (isset($CDASH_FULL_EMAIL_WHEN_ADDING_USER) && $CDASH_FULL_EMAIL_WHEN_ADDING_USER == 1) {
        $xml .= add_XML_value('fullemail', '1');
    }
    $xml .= '</cdash>';
    // Now doing the xslt transition
    generate_XSLT($xml, 'manageUsers');
}
Example #17
Show file File: users.php Project: anthonybjturner/2015FallWeb
0
     break;
     break;
 case 'details_GET':
     $model = User::Get($_REQUEST['id']);
     $view = "users/details.php";
     break;
 case 'edit_GET':
     $model = User::Get($_REQUEST['id']);
     $view = "users/edit.php";
     break;
 case 'delete_GET':
     $model = User::Get($_REQUEST['id']);
     $view = "users/delete.php";
     break;
 case 'delete_POST':
     $errors = User::Delete($_REQUEST['id']);
     if ($errors) {
         $model = User::Get($_REQUEST['id']);
         $view = "users/delete.php";
     } else {
         if ($format == 'json') {
             header("Location: ?action=edit&format=json&id={$_REQUEST['id']}");
         } else {
             header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}");
         }
         //header("Location: ?sub_action=$sub_action&id=$_REQUEST[id]");
     }
     break;
 case 'search_GET':
     $model = User::Search($_REQUEST['q']);
     $view = 'users/index.php';