当前位置: 首页>>代码示例>>PHP>>正文


PHP user::delete方法代码示例

本文整理汇总了PHP中user::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP user::delete方法的具体用法?PHP user::delete怎么用?PHP user::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user的用法示例。


在下文中一共展示了user::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formAction

function formAction()
{
    global $tpl, $login;
    $commit = isset($_REQUEST['chkcommit']) ? $_REQUEST['chkcommit'] + 0 : 0;
    $delete = isset($_REQUEST['chkdelete']) ? $_REQUEST['chkdelete'] + 0 : 0;
    $disable = isset($_REQUEST['chkdisable']) ? $_REQUEST['chkdisable'] + 0 : 0;
    $userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0;
    $user = new user($userid);
    if ($user->exist() == false) {
        $tpl->error(ERROR_UNKNOWN);
    }
    $username = $user->getUsername();
    if ($delete == 1 && $disable == 1) {
        $tpl->error('You cannot delete and disable the same time!');
    }
    if ($commit == 0) {
        $tpl->error('You have to check that you are sure!');
    }
    if ($disable == 1) {
        if ($user->disable() == false) {
            $tpl->error(ERROR_UNKNOWN);
        }
    } else {
        if ($delete == 1) {
            if ($user->delete() == false) {
                $tpl->error(ERROR_UNKNOWN);
            }
        }
    }
    $tpl->redirect('adminuser.php?action=searchuser&username=' . urlencode($username));
}
开发者ID:RH-Code,项目名称:opencaching,代码行数:31,代码来源:adminuser.php

示例2: delete

 /**
 	Deletes one user	*/
 public function delete()
 {
     global $__in, $__out;
     try {
         $user = new user();
         $user->delete($__in['id']);
         return dispatcher::redirect("getall", "deleted_successfully");
     } catch (ValidationException $ex) {
         $ex->publish_errors();
         return dispatcher::redirect("getall");
     } catch (Exception $ex) {
         throw $ex;
     }
 }
开发者ID:halaby,项目名称:smlite-framework,代码行数:16,代码来源:useradmin_controller.php

示例3: formAction

function formAction()
{
    global $tpl, $login, $translate;
    $commit = isset($_REQUEST['chkcommit']) ? $_REQUEST['chkcommit'] + 0 : 0;
    $delete = isset($_REQUEST['chkdelete']) ? $_REQUEST['chkdelete'] + 0 : 0;
    $disable = isset($_REQUEST['chkdisable']) ? $_REQUEST['chkdisable'] + 0 : 0;
    $emailproblem = isset($_REQUEST['chkemail']) ? $_REQUEST['chkemail'] + 0 : 0;
    $datalicense = isset($_REQUEST['chkdl']) ? $_REQUEST['chkdl'] + 0 : 0;
    $userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0;
    $disduelicense = isset($_REQUEST['chkdisduelicense']) ? $_REQUEST['chkdisduelicense'] + 0 : 0;
    $user = new user($userid);
    if ($user->exist() == false) {
        $tpl->error(ERROR_UNKNOWN);
    }
    $username = $user->getUsername();
    if ($delete + $disable + $disduelicense > 1) {
        $tpl->error($translate->t('Please select only one of the delete/disable options!', '', '', 0));
    }
    if ($commit == 0) {
        $tpl->error($translate->t('You have to check that you are sure!', '', '', 0));
    }
    if ($disduelicense == 1) {
        $errmesg = $user->disduelicense();
        if ($errmesg !== true) {
            $tpl->error($errmesg);
        }
    } else {
        if ($disable == 1) {
            if ($user->disable() == false) {
                $tpl->error(ERROR_UNKNOWN);
            }
        } else {
            if ($delete == 1) {
                if ($user->delete() == false) {
                    $tpl->error(ERROR_UNKNOWN);
                }
            } else {
                if ($emailproblem == 1) {
                    $user->addEmailProblem($datalicense);
                }
            }
        }
    }
    $tpl->redirect('adminuser.php?action=searchuser&username=' . urlencode($username) . '&success=' . ($disduelicense + $disable));
}
开发者ID:PaulinaKowalczuk,项目名称:oc-server3,代码行数:45,代码来源:adminuser.php

示例4: setup

 function setup()
 {
     //Grab the user
     if (isset($_GET['cid'])) {
         $confirm_id = $_GET['cid'];
     } else {
         header("HTTP/1.0 404 Not Found");
         exit;
     }
     $user = new user();
     if ($user->load_from_confirm_id($confirm_id)) {
         //Grab the postcode and area
         $this->postcode = $user->postcode;
         $this->alert_area_size = alert_size_to_meters($user->alert_area_size);
         //delete the user
         $user->delete();
     } else {
         header("HTTP/1.0 404 Not Found");
         exit;
     }
 }
开发者ID:adrianshort,项目名称:planningalerts,代码行数:21,代码来源:unsubscribe.php

示例5: elseif

        } elseif (!empty($_POST['email'])) {
            // email change request
            $result = user::change_email($_SESSION['user']['id'], $_POST['email']);
            if ($result) {
                redirect('?p=account&action=email&ok');
                die;
            } else {
                echo '<p>Impossible to change email!</p>';
            }
        }
    } elseif ($action == 'delete') {
        if (!empty($_POST['csrf_token'])) {
            $token = $_POST['csrf_token'];
            $valid = csrf::check($token, $_SESSION['token']);
            if ($valid) {
                $result = user::delete($_SESSION['user']['id']);
                if ($result) {
                    redirect('?p=disconnect&delete');
                    die;
                } else {
                    echo '<p>Impossible to delete this account!</p>';
                }
            } else {
                echo '<p style="color:red;">Wrong CSRF token!</p>';
            }
        }
    } else {
        // unknown action
    }
}
?>
开发者ID:Groscheri,项目名称:csrf-seminar,代码行数:31,代码来源:account.php

示例6: user

                ?>
&action=user_deleted">Yes, delete this user.</a> |
					<a href="<?php 
                echo RAPID_DIR;
                ?>
">No, take me back!</a>
				</p>
				
				<?php 
                include "footer.php";
                break;
            case 'user_deleted':
                include_once "includes/class.user.php";
                $u = new user();
                $u->username = $_GET['name'];
                if ($u->delete()) {
                    include "header.php";
                    ?>
					
					<h1>User Deleted</h1>
					<p>The user has been deleted successfully.</p>
					<p><a href="<?php 
                    echo RAPID_DIR;
                    ?>
">Return to the Main Page</a><p>
					
					<?php 
                    include "footer.php";
                } else {
                    include "header.php";
                    ?>
开发者ID:rapidcms,项目名称:RapidCMS,代码行数:31,代码来源:index.php

示例7: maintainUsers

 function maintainUsers()
 {
     $three_months_in_past = strtotime('-3 months');
     $three_months_in_past = strftime('%Y-%m-%d %H:%M:%S', $three_months_in_past);
     // get ids of all users in system
     $uids = user::getAllUserIds();
     // look at each user closely
     foreach ($uids as $uid) {
         $user = new user($uid);
         // did user log in within last 3 months?
         if ($user->getLastLoginTimestampStr() < $three_months_in_past) {
             // is user member of a team?
             $teamIds = $user->getTeamIds();
             if ($teamIds !== false) {
                 // check if teams of user are not deleted
                 // assume all teams are deleted by default then check status of each team
                 // this will work better with a very high number of teams because it avoids
                 // to load a huge list of deleted team ids into memory first
                 $teamsDeleted = count($teamIds) > 0 ? true : false;
                 foreach ($teamIds as $teamid) {
                     $team = new team($teamid);
                     // if getting status of team failed or status is not deleted then do not delete user
                     if ($team->getStatus() !== 'deleted') {
                         $teamsDeleted = false;
                     }
                 }
                 if ($teamsDeleted) {
                     $this->maintainPMs($uid);
                     $user->delete();
                 }
             }
         }
     }
 }
开发者ID:laiello,项目名称:bz-owl,代码行数:34,代码来源:maintenance.php

示例8: user

 $user = new user(null, $_log);
 $salt = hash::salt(32);
 if ($data = $_db->get('Users', array('Username', '=', $username))) {
     //var_dump($data);
     if ($data->counts() > 0) {
         if ($data->first()->User_Verified == 0) {
             if ($data->first()->Confirm_Hash == $confirmCode) {
                 $oldUser = $data->first()->Old_User;
                 try {
                     $user->updateUser(array('Password' => hash::make(input::get('Password'), $salt), 'Salt' => $salt, 'User_Verified' => 1, 'Confirm_Hash' => null, 'Old_User' => null), $_GET['Username']);
                     session::flash('home', 'Your password has been created');
                     $_log->info('Username verified: ' . $username);
                     // Will be logged
                     if ($oldUser !== null) {
                         try {
                             if ($user->delete($oldUser)) {
                                 $_log->info('Old user deleted: ' . (string) $oldUser);
                             } else {
                                 $_log->warning('Old user NOT deleted: ' . (string) $oldUser);
                             }
                         } catch (Exception $e) {
                             var_dump($e->getMessage());
                             $_log->info($e->getMessage());
                             die($e->getMessage());
                         }
                     }
                     if ($user->login($username, input::get('Password'))) {
                         redirect::to('../index.php');
                     }
                 } catch (Exception $e) {
                     $_log->info('Could not update verify user in DB', $fields);
开发者ID:jdupreez1,项目名称:smartpoint,代码行数:31,代码来源:emailVerify.php

示例9: explode

 function action_delete()
 {
     global $CURMAN;
     require_once CURMAN_DIRLOCATION . '/lib/user.class.php';
     $users = explode(',', $this->required_param('selectedusers', PARAM_TEXT));
     // make sure everything is an int
     foreach ($users as $key => $val) {
         $users[$key] = (int) $val;
         if (empty($users[$key])) {
             unset($users[$key]);
         }
     }
     $result = true;
     foreach ($users as $userid) {
         $userobj = new user($userid);
         if (!($result = $userobj->delete())) {
             break;
         }
     }
     $tmppage = new bulkuserpage();
     if ($result) {
         redirect($tmppage->get_url(), get_string('success_bulk_delete', 'block_curr_admin'));
     } else {
         print_error('error_bulk_delete', 'block_curr_admin', $tmppage->get_url());
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:26,代码来源:bulkuserpage.class.php

示例10: elseif

    # fill user with submitted data
    $userInst->id = tool::securePost('id');
    $userInst->fill(tool::securePostAll());
    if (!DEMO_MODE) {
        $status = $userInst->update();
    } else {
        $toolInst->errorStatus("not allowed in this demo. Sorry ;)");
    }
} elseif (tool::securePost('action') && tool::securePost('action') == "save") {
    $userInst->fill(tool::securePostAll());
    $status = $userInst->insert();
}
if (tool::securePost('action') && tool::securePost('action') == "delete" && tool::securePost('id') && tool::securePost('id') != "") {
    $userInst->id = tool::securePost('id');
    if (!DEMO_MODE) {
        $userInst->delete();
    } else {
        $toolInst->errorStatus("not allowed in this demo. Sorry ;)");
    }
}
if (tool::securePost('action') && tool::securePost('action') == "edit" && tool::securePost('id') && tool::securePost('id') != "") {
    $status = 0;
    $userInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
if (!$status) {
    echo "<h2>" . $lang['common_editRecord'] . " (<a href=\"" . $toolInst->encodeUrl("index.php?content=" . $content) . "\">" . $lang['common_newRecord'] . "</a>)</h2>\n";
} else {
    $userInst->clear();
    echo "<h2>" . $lang['common_newRecord'] . "</h2>\n";
开发者ID:pmtool,项目名称:pmtool,代码行数:31,代码来源:users.php

示例11: explode

 function do_delete()
 {
     // action_delete()
     require_once elispm::lib('data/user.class.php');
     $this->session_selection_deletion();
     $users = explode(',', $this->required_param('selectedusers', PARAM_TEXT));
     // make sure everything is an int
     foreach ($users as $key => $val) {
         $users[$key] = (int) $val;
         if (empty($users[$key])) {
             unset($users[$key]);
         }
     }
     foreach ($users as $userid) {
         $userobj = new user($userid);
         $userobj->delete();
         // TBD: try {} catch () {} ???
     }
     $tmppage = new bulkuserpage();
     redirect($tmppage->url, get_string('success_bulk_delete', 'local_elisprogram'));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:21,代码来源:bulkuserpage.class.php

示例12: user

<?php

if (isset($_REQUEST['i']) && !empty($_REQUEST['i'])) {
    $user = new user();
    $user->setId($_REQUEST['i']);
    if ($user->delete()) {
        print 'sucess';
    } else {
        print 'error';
    }
} else {
    print 'error';
}
开发者ID:DaniJCV,项目名称:BO2-BOxygen,代码行数:13,代码来源:user_del.php

示例13: confirmDelete

<?php

include_once 'config/db_conn.php';
include_once 'db_config/db_gigs.php';
include_once 'db_config/db_user.php';
$user = new user();
$rs_user = $user->user_list();
if ($_REQUEST['id']) {
    $user->delete($_REQUEST['id']);
    reDirect('users.php');
}
?>
<!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>Orders - Admin </title>
<link rel="stylesheet" type="text/css" href="css/theme.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script>
   var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
   document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '">');
</script>
<script>
function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete")) {
    document.location = delUrl;
  }
}
</script>
<!--[if IE]>
开发者ID:mix376,项目名称:biverr,代码行数:31,代码来源:orders.php

示例14: test

 /**
  * test
  * 
  * tests almost all functions in the class
  * 
  * @return boolean
  */
 public function test()
 {
     $pass = true;
     $user1 = new user();
     $user1->create('testuser4', 'Passw0rd', 'test@email4.com', 'TEST');
     $user2 = new user();
     $user2->create('testuser5', 'Passw0rd', 'test@email5.com', 'TEST');
     //create
     $pass = $this->testRun($this->create($user2->id, $user1->id, "this is a test message." . time()));
     echo "|create\n";
     //getOutgoing
     $outmess = $this->getOutgoing($user1->id);
     $pass = $this->testRun($outmess);
     echo "|getOutgoing\n";
     //getIncoming
     $this->create($user1->id, $user2->id, "this is a second test message." . time());
     $inmess = $this->getIncoming($user1->id);
     $pass = $this->testRun($inmess);
     echo "|getIncomming\n";
     //delete
     $delpass = true;
     foreach ($inmess as $mess) {
         if (!$this->delete($mess['id'])) {
             $delpass = false;
         }
     }
     foreach ($outmess as $mess) {
         if (!$this->delete($mess['id'])) {
             $delpass = false;
         }
     }
     $pass = $this->testRun($delpass);
     echo "|delete\n";
     $user1->delete();
     $user2->delete();
     return $pass;
 }
开发者ID:ericpelland,项目名称:Streaming-Website,代码行数:44,代码来源:message.php

示例15: run

function run()
{
    global $user;
    global $layout;
    global $DB;
    $out = '';
    $item = new user();
    switch ($_REQUEST['act']) {
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    $deleted = 0;
                    foreach ($ids as $id) {
                        $item = new user();
                        $item->load($id);
                        $deleted = $deleted + $item->delete();
                    }
                    echo json_encode(count($ids) == $deleted);
                    break;
                default:
                    // list or search
                    $page = intval($_REQUEST['page']);
                    $max = intval($_REQUEST['rows']);
                    $offset = ($page - 1) * $max;
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    $where = " 1=1 ";
                    if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
                        if (isset($_REQUEST['quicksearch'])) {
                            $where .= $item->quicksearch($_REQUEST['quicksearch']);
                        } else {
                            if (isset($_REQUEST['filters'])) {
                                $where .= navitable::jqgridsearch($_REQUEST['filters']);
                            } else {
                                // single search
                                $where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
                            }
                        }
                    }
                    $DB->queryLimit('id,username,email,profile,language,blocked', 'nv_users', $where, $orderby, $offset, $max);
                    $dataset = $DB->result();
                    $total = $DB->foundRows();
                    //echo $DB->get_last_error();
                    $out = array();
                    $profiles = profile::profile_names();
                    $languages = language::language_names();
                    for ($i = 0; $i < count($dataset); $i++) {
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => '<strong>' . $dataset[$i]['username'] . '</strong>', 2 => $dataset[$i]['email'], 3 => $profiles[$dataset[$i]['profile']], 4 => $languages[$dataset[$i]['language']], 5 => $dataset[$i]['blocked'] == 1 ? '<img src="img/icons/silk/cancel.png" />' : '');
                    }
                    navitable::jqgridJson($out, $page, $offset, $max, $total);
                    break;
            }
            session_write_close();
            exit;
            break;
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    permission::update_permissions(json_decode($_REQUEST['navigate_permissions_changes'], true), 0, $item->id);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
            }
            $out = users_form($item);
            break;
        case 4:
            // remove
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = users_list();
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = users_form($item);
                }
            }
            break;
        case 0:
            // list / search result
        // list / search result
        default:
            $out = users_list();
            break;
    }
    return $out;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:96,代码来源:users.php


注:本文中的user::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。