$filterPostEndereco = array('rua' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,1000}\$/")), 'numero' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,20}\$/")), 'complemento' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,500}\$/")), 'bairro' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,500}\$/")), 'cidade' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,500}\$/")), 'bairro' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,500}\$/")), 'cidade' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,500}\$/")), 'estado' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,10}\$/")), 'cep' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,10}\$/")), 'tel_fixo' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,20}\$/")), 'celular' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,20}\$/")));
$filterTelegram = array('descricao' => array('filter' => FILTER_SANITIZE_STRING), 'bot_token' => array('filter' => FILTER_SANITIZE_STRING), 'users_bots_id' => array('filter' => FILTER_VALIDATE_INT));
$filterGET = array('action' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^(excluir|imprimir)\$/")), 'page' => array('filter' => FILTER_VALIDATE_INT), 'id' => array('filter' => FILTER_VALIDATE_INT), 'pgname' => array('filter' => FILTER_SANITIZE_STRING));
$filterFinanceiro = array('data_vencimento' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}\$/")));
//
$data_org = filter_input_array(INPUT_POST);
$datauser = filter_input_array(INPUT_POST, $filterPostUser);
$data = filter_input_array(INPUT_POST, $filterPostUserInfo);
$data_endereco = filter_input_array(INPUT_POST, $filterPostEndereco);
$data_financeiro = filter_input_array(INPUT_POST, $filterFinanceiro);
$data_telegram = filter_input_array(INPUT_POST, $filterTelegram);
$dataGet = filter_input_array(INPUT_GET, $filterGET);
//print_r($dataGet);
//
try {
    $revendas = revendedorBO::getRevendas(1000);
    $planos = plano_assinaturaBO::getListaCombo();
    $moedas = moedasBO::getListaCombo();
    if ($data) {
        $response = array();
        if (empty($data['nome'])) {
            $response['error'][] = 'Preencher nome';
        } else {
            if ($datauser['passwlogin'] == NULL) {
                $response['error'][] = 'Preencher senha corretamanete (mínimo 5 caracteres)';
            } else {
                if ($datauser['phone'] == NULL) {
                    $response['error'][] = 'Preencher whatsapp';
                } else {
                    if ($data['tpPessoa'] == NULL) {
                        $response['error'][] = 'Pessoa Tipo Inválido!';
Exemple #2
0
require_once '../sealed/controler/paginador.php';
$user = new User();
usuarioBO::checkExpireLogin();
usuarioBO::checkSession();
include_once "../lib/utils/funcoes.php";
$filterGET = array('action' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^(excluir)\$/")), 'id' => array('filter' => FILTER_VALIDATE_INT), 'page' => array('filter' => FILTER_VALIDATE_INT), 'revenda_id' => array('filter' => FILTER_VALIDATE_INT));
$argsPost = array('action' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^(excluir)\$/")), 'ids' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY), 'page' => array('filter' => FILTER_VALIDATE_INT));
$inputPOST = filter_input_array(INPUT_POST, $argsPost);
$dataGet = filter_input_array(INPUT_GET, $filterGET);
try {
    $count = revendedorBO::getRevendasCount();
    if (!$dataGet['page']) {
        $dataGet['page'] = 1;
    }
    $paginador = new paginador($dataGet['page'], $count, 20, '');
    $dados = revendedorBO::getRevendas($paginador->getPage());
    /**
     * action via post EXCLUIR
     */
    if (isset($dataGet['action'])) {
        if ($dataGet['action'] == 'excluir') {
            if (isset($dataGet['revenda_id'])) {
                try {
                    $result = revendedorBO::deletar($dataGet['revenda_id']);
                    if ($result == TRUE) {
                        $response['success'][] = 'Revenda excluída com sucesso!';
                        $response['link'] = 'revenda.php?page=' . $dataGet['page'];
                    } else {
                        $response['error'][] = "Revenda já está vinculado a um usuário !!";
                    }
                } catch (Exception $err) {