Exemplo n.º 1
0
function IsChecked($chkname, $connection)
{
    if (!empty($_POST[$chkname])) {
        foreach ($_POST[$chkname] as $value) {
            $delsql = "delete from customer where custID='" . $value . "';";
            deleteCustomer($delsql, $connection);
        }
    }
}
Exemplo n.º 2
0
}
function writeCustomer()
{
    //decode json object into associate array to extract email to use as filename
    $json = file_get_contents("php://input");
    $filedata = json_decode($json, true);
    $filename = '../customers/' . $filedata['email'] . ".json";
    //write json to file
    if (file_put_contents($filename, $json)) {
        http_response_code(200);
    } else {
        http_response_code(400);
    }
    return true;
}
//handle the request based on the method
$requestType = $_SERVER['REQUEST_METHOD'];
switch ($requestType) {
    case 'GET':
        getCustomers();
        break;
    case 'DELETE':
        deleteCustomer();
        break;
    case 'PUT':
        writeCustomer();
        break;
    default:
        echo "Error, request method {$requestType} is not supported";
        break;
}
Exemplo n.º 3
0
/*=============================================================================*/
//Most forms on the site will be sent here. The last element of the request    //
//will contain the information about the users action and be popped off the    //
//array to determine what will happen.                                         //
/*=============================================================================*/
include "Functions.php";
include "Customer.php";
session_start();
$userAction = array_pop($_REQUEST);
switch ($userAction) {
    case 'delete':
        $id = array_pop($_REQUEST);
        session_destroy();
        session_start();
        //Set session variables for delete success or failure
        if (deleteCustomer($id)) {
            $_SESSION["message"] = "Delete Successful!";
            $_SESSION["lastpage"] = "index.php";
        } else {
            $_SESSION["message"] = "Delete failed";
            $_SESSION["message"] = "edit.php";
        }
        $_SESSION['loggedin'] = 'FALSE';
        $_SESSION['message'] = "Account Successfully Deleted!";
        header("Location: messages.php");
        break;
    case 'edit':
        header("Location: edit.php");
        break;
        //submits the users edit to the database and sets new session variables.
    //submits the users edit to the database and sets new session variables.
Exemplo n.º 4
0
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if (isset($_GET['delete_id']) && !empty($_GET['delete_id'])) {
    # admin/reseller deletion
    if (admin_validateUserDeletion($_GET['delete_id'])) {
        admin_deleteUser($_GET['delete_id']);
    }
    redirectTo('manage_users.php');
} elseif (isset($_GET['user_id'])) {
    # customer deletion validation page
    $tpl = admin_generateCustomerAcountDeletionValidationPage($_GET['user_id']);
} elseif (isset($_POST['user_id']) && isset($_POST['delete']) && $_POST['delete'] == 1) {
    # Customer deletion
    $userId = clean_input($_POST['user_id']);
    try {
        if (!deleteCustomer($userId)) {
            showBadRequestErrorPage();
        }
        set_page_message(tr('Customer account successfully scheduled for deletion.'), 'success');
        write_log(sprintf('%s scheduled deletion of the customer account with ID %d', $_SESSION['user_logged'], $userId), E_USER_NOTICE);
    } catch (iMSCP_Exception $e) {
        if (($previous = $e->getPrevious()) && $previous instanceof iMSCP_Exception_Database) {
            /** @var $previous iMSCP_Exception_Database */
            $queryMessagePart = ' Query was: ' . $previous->getQuery();
        } else {
            $queryMessagePart = '';
        }
        set_page_message(tr('Unable to schedule deletion of the customer account. Please consult admin logs or your mail for more information.'), 'error');
        write_log(sprintf("System was unable to schedule deletion of customer account with ID %s. Message was: %s.", $userId, $e->getMessage() . $queryMessagePart), E_USER_ERROR);
    }
    redirectTo('manage_users.php');
Exemplo n.º 5
0
        if (DbManager::i()->update("sf_members", array("password" => $password), array("userid" => intval($c)))) {
            unset($password);
            unset($key);
            unset($iv);
            unset($info);
            Logger::i()->writeLog("Password renewed for UserID: {$c}, password = {$plain}");
            return Submission::createResult($plain, true);
        }
    }
    Logger::i()->writeLog("Renew password failed, error = " . DbManager::i()->error, 'dev');
    return Submission::createResult("Could not renew password");
}
function deleteCustomer($c)
{
    $delete = DbManager::i()->delete("sf_members", array("userid" => intval($c)));
    if (!$delete) {
        Logger::i()->writeLog("Deleting customer {$c} failed, error = " . DbManager::i()->error, 'dev');
        return Submission::createResult("Could not delete customer");
    }
    return Submission::createResult("Customer deleted", true);
}
switch ($_POST['action']) {
    case 'renew':
        echo renewPassword($_POST['customerid']);
        break;
    case 'delete':
        echo deleteCustomer($_POST['customerid']);
        break;
    default:
        break;
}
Exemplo n.º 6
0
$customers = getCustomers($data);
$pagination = new Pagination();
$pagination->total = $total_customer;
$pagination->page = $page;
$pagination->limit = $numrows;
$pagination->url = "customer/page{page}.html";
$pagination = $pagination->render();
$url = '';
if ($order == 'ASC') {
    $url .= '/DESC';
} else {
    $url .= '/ASC';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['selected'])) {
    foreach ($_POST['selected'] as $customer_id) {
        $delete_query = deleteCustomer($customer_id);
        if ($delete_query) {
            $_SESSION['success'] = $lang['success_delete'];
            header('Location:customer.html');
        } else {
            $_SESSION['error_warning'] = $lang['error_query'];
        }
    }
}
?>
<div id="content">
	<div class="breadcrumb">
		<a href="home.html"><?php 
echo $lang['text_home'];
?>
</a>
Exemplo n.º 7
0
Functions::checkRights(__FILE__, $action, Functions::get('token'));
switch ($action) {
    case 'fields_info':
        $data = infoFields();
        break;
    case 'new':
        $data = addCustomer();
        break;
    case 'update':
        $data = updateCustomer(Functions::get('id'));
        break;
    case 'info':
        $data = infoCustomer(Functions::get('id'));
        break;
    case 'delete':
        $data = deleteCustomer(Functions::get('id'));
        break;
    case 'total_entries':
        $data = getTotalEntries(Functions::get('id'));
        break;
    case 'total_sells':
        $data = getTotalSells(Functions::get('id'));
        break;
    case 'balance':
        $data = getBalance(Functions::get('id'));
        break;
    case 'favdrink':
        $data = getFavDrink(Functions::get('id'));
        break;
    case 'login':
        $data = loginUser();
Exemplo n.º 8
0
<?php

// initialize
include_once '../../../common/init.php';
if (!isLoggedInAdmin()) {
    redirect('');
} else {
    // include needed database functions
    include_once $BASE_PATH . 'database/customers.php';
    $id = $_GET['id'];
    if (!empty($id)) {
        deleteCustomer($id);
    }
    redirect('pages/manager/customers/list_customers.php');
}
Exemplo n.º 9
0
<?php

include 'db/pdo.php';
$no_cust = $_GET["no_cust"];
$customers = getDataCustomer2($no_cust);
$nama_customer = $customers[0]['nama_cust'];
$hapus_customer = deleteCustomer($no_cust);
//var_dump($customers);
//echo $nama_customer;
if (isset($hapus_customer)) {
    header("Location: {$base_url}/customer.php?hapus={$nama_customer}");
}
Exemplo n.º 10
0
    }
    return $tpl;
}
/***********************************************************************************************************************
 * Main script
 */
// Include core library
require 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptStart);
check_login('reseller');
if (isset($_GET['id']) && !empty($_GET['id'])) {
    $tpl = reseller_generateCustomerAcountDeletionValidationPage($_GET['id']);
} elseif (isset($_POST['id']) && isset($_POST['delete']) && $_POST['delete'] == 1) {
    $customerId = clean_input($_POST['id']);
    try {
        if (!deleteCustomer($customerId, true)) {
            showBadRequestErrorPage();
        }
        set_page_message(tr('Customer account successfully scheduled for deletion.'), 'success');
        write_log(sprintf('%s scheduled deletion of the customer account with ID %d', $_SESSION['user_logged'], $customerId), E_USER_NOTICE);
    } catch (iMSCP_Exception $e) {
        set_page_message(tr('Unable to schedule deletion of the customer account. A message has been sent to the administrator.'), 'error');
        write_log(sprintf("System was unable to schedule deletion of the customer account with ID %s. Message was: %s", $customerId, $e->getMessage()), E_USER_ERROR);
    }
    redirectTo('users.php');
} else {
    if (isset($_GET['delete'])) {
        showBadRequestErrorPage();
    } else {
        set_page_message(tr('You must confirm customer account deletion.'), 'error');
        redirectTo('user_delete.php?id=' . $_POST['id']);