Example #1
0
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['deleteUser']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) {
    require_once ROOT_PATH . "/apps/users/models/users.class.php";
    $cms = new users();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteUserGroup']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) {
    require_once ROOT_PATH . "/apps/users/models/groups.class.php";
    $cms = new groups();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteWithdraw']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) {
    require_once ROOT_PATH . "/apps/users/models/deposit.class.php";
    $cms = new deposit();
    $cms->deleteWithdraw(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) {
    require_once ROOT_PATH . "/apps/items/models/comments.class.php";
    $cms = new comments();
    $cms->delete(intval($_POST['id']));
Example #2
0
<!-- All Will Write Their Code Here -->
<div class="row">
<div class="row table-responsive">
	
	<?php 
    if (isset($_GET['del_id'])) {
        $del_id = $_GET['del_id'];
        if ($validate->checkNotNull($del_id)) {
            if ($validate->checkNumeric($del_id)) {
                if ($validate->checkID($del_id)) {
                    if ($orders->checkFoundOrdersForId($del_id)) {
                        ?>
<div class="alert alert-danger text-center">Cannot Delete This User Becous he already Get  Orders</div><?php 
                    } else {
                        $users->delete($del_id);
                    }
                } else {
                    echo "No User Found With This Data";
                }
            } else {
                header("location:home.php");
            }
        } else {
            header("location:home.php");
        }
    }
    /*
    		if(isset($_GET['unavailable']))
    		{
    			$roomNum=$_GET['unavailable'];
Example #3
0
$app->get('/admin/users/setStat/:userID/:status', $authenticateAdmin, function ($userID, $status) use($app) {
    $dbh = getConnection();
    users::setStatus($dbh, $userID, $status);
    die;
});
$app->post('/admin/users/New/', $authenticateAdmin, function () use($app) {
    $dbh = getConnection();
    $userData = $app->request->post();
    users::create($dbh, $userData);
    die;
});
$app->post('/admin/users/:userID/', $authenticateAdmin, function ($userID) use($app) {
    $dbh = getConnection();
    $userData = $app->request->post();
    users::update($dbh, $userID, $userData);
    die;
});
$app->get('/admin/users/setRole/:userID/:roleID/', $authenticateAdmin, function ($userID, $roleID) use($app) {
    $dbh = getConnection();
    users::setRole($dbh, $userID, $roleID);
    die;
});
$app->get('/admin/users/del/:userID/', $authenticateAdmin, function ($userID) use($app) {
    $dbh = getConnection();
    users::delete($dbh, $userID);
    die;
});
$app->post('/upload/:directory/', $authenticateAdmin, function ($directory) use($app) {
    $env = $app->environment();
    echo upload::handleUpload($env['baseDir'] . 'img/' . $directory . '/');
});
Example #4
0
    $valSurname = $a[0];
    $valName = $a[1];
    $valFname = $a[2];
}
//делаю апдейт
$b = $new->updateById($id);
if ($b == 1) {
    header("Location: http://site.dev/class/class.php");
    $valSurname = '';
    $valName = '';
    $valFname = '';
}
//вношу данные
$c = $new->insert();
//удаляю данные
$d = $new->delete($id);
//вытаскиваю всю базу
$all = $new->selectAll();
//Создаю заголовки таблицы и добавляю их в массив таблицы
$head = ['id' => 'ID', 'surname' => 'SURNAME', 'nam' => 'NAME', 'fname' => "FATHER'S NAME", 'bdel' => 'DELETE', 'up' => 'UPDATE'];
array_unshift($all, $head);
//создаю ссылки для апдейта и делита и добавляю их в массив таблицы
for ($t = 1; $t < count($all); $t++) {
    $del[$t] = '<a href="http://site.dev/class/class.php?action=delete&id=' . $all[$t]['id'] . '">DELETE</a>';
    $up[$t] = '<a href="http://site.dev/class/class.php?action=update&id=' . $all[$t]['id'] . '">UPDATE</a>';
}
for ($m = 1; $m < count($all); $m++) {
    $all[$m]['del'] = $del[$m];
    $all[$m]['up'] = $up[$m];
}
/*
Example #5
0
<?php

if ($_POST) {
    include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php';
    include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/users.php';
    $database = new database();
    $db = $database->getConnection();
    $users = new users($db);
    $users->username = $_POST['object_id'];
    if ($users->delete()) {
        echo "User berhasil dihapus.";
    } else {
        echo "User tidak bisa dihapus.";
    }
}
Example #6
0
print_r($_GET);
echo '</pre>';
echo '<pre>';
print_r($_POST);
echo '</pre>';
$new = new users();
echo 'table name is ' . $new->tableName() . '<br>';
if (isset($_GET['id'])) {
    $id = $_GET['id'];
} else {
    $id = 0;
}
echo 'id = ' . $id . '<br>';
$sellect = $new->selectForUpdate($id);
$update = $new->updateById($id);
$delete = $new->delete($id);
$insert = $new->insert();
$sellectAll = $new->selectAll();
?>

<!DOCTYPE HTML>
<html>
<head>
    <title>Class work</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="bootstrap.css">
    <script type="text/javascript" scr="bootstrap.js"></script>
</head>
<body>
<h4>Please, enter your data into the form below</h4>
    <form action="class.php" method="POST">