本文整理汇总了PHP中Users::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::delete方法的具体用法?PHP Users::delete怎么用?PHP Users::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
include_once "models/Users.php";
$users = new Users();
$users->delete();
//header("Location: ../logout");
}
示例2: deleteAction
public function deleteAction($userId)
{
$user = new Users();
$user->id = $userId;
$user->delete();
return $this->dispatcher->forward(array('action' => 'index'));
}
示例3: pdoDeleteModelAction
public function pdoDeleteModelAction($id)
{
$users = new Users();
$row = $users->get($id);
if (!empty($row)) {
$users->delete($id);
}
redirect('pdo-database/pdo-model/pdo-model');
}
示例4: testUserCreate
public function testUserCreate()
{
$model = new Users();
$model->attributes = array('email' => 'example2@ciims.io', 'password' => 'example_password', 'username' => 'example_user2', 'user_role' => '9', 'status' => '1');
// Verify that we can save a new record
$this->assertTrue($model->save());
// Verify that bcrypt password validation passes
$this->assertTrue(password_verify('example_password', $model->password));
$this->assertTrue($model->delete());
}
示例5: testExists
/**
* testExists function
* @return void
*/
public function testExists()
{
$this->loadFixtures('User');
$TestModel = new Users();
$this->assertTrue($TestModel->exists(1));
$TestModel->id = 2;
$this->assertTrue($TestModel->exists());
$TestModel->delete();
$this->assertFalse($TestModel->exists());
$this->assertFalse($TestModel->exists(2));
}
示例6: usersAction
/**
* Page
*/
public function usersAction()
{
$usersModel = new Users();
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
if (@$data['method'] == 'create') {
//CREATE NEW USER
unset($data['method']);
if ($data['email'] == '' || $data['password'] == '') {
$this->view->error = "Please complete all fields.";
$this->view->data = $data;
} else {
$data['password'] = sha1($data['password']);
$usersModel->insert($data);
$this->view->success = "New User Created.";
}
}
if (@$data['method'] == 'update') {
//UPDATE USER
unset($data['method']);
if ($data['password'] == '') {
unset($data['password']);
} else {
$data['password'] = sha1($data['password']);
}
$usersModel->updateRecord($data['id'], $data);
$this->view->success = "User Record Updated.";
}
if (@$data['method'] == 'delete') {
//DELETE USER
$where = "id=" . $data['id'];
$usersModel->delete($where);
}
}
$users = $usersModel->getAll();
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($users);
$paginator->setItemCountPerPage(20);
$paginator->setCurrentPageNumber($page);
$this->view->users = $paginator;
$locationsModel = new Locations();
$this->view->locations = $locationsModel->getAll();
}
示例7: AdminPage
<?php
require_once "config.php";
require_once WWW_DIR . "/lib/content.php";
require_once WWW_DIR . "/lib/adminpage.php";
$page = new AdminPage();
if (isset($_GET['id'])) {
$users = new Users();
$users->delete($_GET['id']);
}
if (isset($_GET['redir'])) {
header("Location: " . $_GET['redir']);
} else {
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);
}
示例8: complete_installation
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$this->setLayout('complete_install');
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submitted') == 'submitted') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setIsAdmin(true);
$administrator->setAutoAssign(true);
$administrator->save();
// Create the contact for administrator
$administrator_contact = new Contact();
$administrator_contact->setId(1);
$administrator_contact->setCompanyId(1);
$administrator_contact->setEmail(array_var($form_data, 'admin_email'));
$administrator_contact->setUserId($administrator->getId());
$administrator_contact->setDisplayName($administrator->getUsername());
$administrator_contact->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}
示例9: delete
function delete($id)
{
$usersModel = new Users();
$usersModel->delete($id);
redirect('admin/user');
}
示例10: cancelAction
function cancelAction()
{
$users_table = new Users();
$username = $this->_identity->username;
if ($this->getRequest()->isPost())
{
$del = strtolower($this->_request->getPost('delete'));
if ($del == 'yes' && !is_null($username))
{
$params = array('username' => $username, 'delete_row' => true);
$params = $this->_rivety_plugin->doFilter($this->_mca . "_pre_delete", $params); // FILTER HOOK
if ($params['delete_row'])
{
$where = $users_table->getAdapter()->quoteInto('username = ?', $username);
$users_table->delete($where);
}
$this->_rivety_plugin->doAction($this->_mca . "_post_delete", $params); // ACTION HOOK
}
$this->_redirect('/default/auth/logout');
}
else
{
if (!is_null($username))
{
$user = $users_table->fetchByUsername($username);
if (!is_null($user)) $this->view->user = $user->toArray();
else $this->_redirect('/');
}
}
}
示例11: wizard_deleteUser
public function wizard_deleteUser()
{
if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
echo 'CATS has lost your session!';
return;
}
/* Bail out if the user doesn't have SA permissions. */
if ($this->_realAccessLevel < ACCESS_LEVEL_SA) {
echo 'You do not have access to delete a user.';
return;
}
if (isset($_GET[$id = 'userID'])) {
$userID = intval($_GET[$id]);
} else {
echo 'Unable to find the user you are trying to delete.';
return;
}
if ($userID == $_SESSION['CATS']->getUserID()) {
echo 'You cannot delete yourself!';
return;
}
$users = new Users($this->_siteID);
$users->delete($userID);
echo 'Ok';
}
示例12: testNestedTransaction
/**
* Test nested transaction
*
* @return void
*/
public function testNestedTransaction()
{
$this->skipIf($this->Dbo->nestedTransactionSupported() === false, 'The Sqlite version do not support nested transaction');
$this->loadFixtures('User');
$model = new Users();
$model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
$model->cacheQueries = false;
$this->Dbo->cacheMethods = false;
$this->assertTrue($this->Dbo->begin());
$this->assertNotEmpty($model->read(null, 1));
$this->assertTrue($this->Dbo->begin());
$this->assertTrue($model->delete(1));
$this->assertEmpty($model->read(null, 1));
$this->assertTrue($this->Dbo->rollback());
$this->assertNotEmpty($model->read(null, 1));
$this->assertTrue($this->Dbo->begin());
$this->assertTrue($model->delete(1));
$this->assertEmpty($model->read(null, 1));
$this->assertTrue($this->Dbo->commit());
$this->assertEmpty($model->read(null, 1));
$this->assertTrue($this->Dbo->rollback());
$this->assertNotEmpty($model->read(null, 1));
}
示例13: Users
if ($_POST['_method'] == 'put') {
$user = new Users($_GET['id']);
$user->id = $_GET['id'];
$user->name = $_POST['name'];
$user->birthday = $_POST['birthday'];
$user->address = $_POST['address'];
$user->username = $_POST['username'];
$user->email = $_POST['email'];
$user->password = $_POST['password'];
$user->credit = $_POST['credit'];
$user->image = $_POST['image'];
$user->update();
} else {
if ($_POST['_method'] == 'delete') {
$user = new Users($_GET['id']);
$user->delete();
$rest = new User_server();
$rest->handle_response('Deleted', 400);
// $response['data'] = 'Deleted';
// $response['status'] = 'Bad Request';
// $json_response = json_encode($response);
// echo $json_response;
}
}
} else {
//insert action
$user = new Users();
$user->name = $_POST['name'];
$user->birthday = $_POST['birthday'];
$user->address = $_POST['address'];
$user->username = $_POST['username'];
示例14: putJsonBody
return putJsonBody(array('error' => true, 'error_code' => $code, 'msg' => $body), 400, $response);
}
/* Handle new user */
$app->post('/user/new', function ($request, $response) {
$data = parseJsonBody($request);
return Users::create($response, $data);
});
/* Handle authenticate user */
$app->post('/user/me', function ($request, $response) {
$data = parseJsonBody($request);
return Users::auth($response, $data);
});
/* Handle delete current user */
$app->delete('/user/me', function ($request, $response) {
$token = parseToken($request);
return Users::delete($response, $token);
});
/* Handle get user info */
$app->get('/user/{id:[0-9]+}/info', function ($request, $response, $args) {
$token = parseToken($request);
$friend_id = $args['id'];
return UsersInfo::get($response, $token, $friend_id);
});
/* Handle get my info */
$app->get('/user/me/info', function ($request, $response) {
$token = parseToken($request);
return UsersInfo::get($response, $token, null);
});
/* Handle update my info */
$app->put('/user/me/info', function ($request, $response) {
$token = parseToken($request);
示例15: Users
<?php
require_once CODE_ROOT . '/classes/users.php';
$users = new Users();
if (empty($request_uri[2])) {
$request_uri[2] = '';
}
$userId = filter_input(INPUT_GET, 'userId', FILTER_VALIDATE_INT);
switch ($request_uri[2]) {
case '':
case 'edit':
if (!empty($request_uri[3]) && is_numeric($request_uri[3])) {
$urlData['id'] = $request_uri[3];
} else {
$urlData['id'] = 0;
}
$users->edit($urlData['id']);
$users->_list();
break;
case 'delete':
if (!empty($request_uri[3])) {
$urlData['id'] = $request_uri[3];
if (is_numeric($urlData['id'])) {
$users->delete($urlData['id']);
}
}
break;
}
$result = $users->result;