revendedorBO::salvar($data, 'revenda', $dataPost['nid']);
                $response['success'][] = 'Senha alterada com sucesso !!!';
            } elseif ($dataPost['nivel'] == 'usuario') {
                $data['passwlogin'] = $dataPost['senha'];
                usuarioBO::salvarUsuario($data, 'users', $dataPost['nid']);
                $response['success'][] = 'Senha alterada com sucesso !!!';
            }
        }
    } elseif ($dataGet['nivel'] == "admin") {
        $dado = usuarioBO::getUsuarios($dataGet['nid']);
        $token = FUNCOES::cryptografar($dataGet['nid'] . $dado->senha);
        if ($token !== $dataGet['token']) {
            throw new Exception('Parâmetros incorretos !!!');
        }
    } elseif ($dataGet['nivel'] == "revenda") {
        $dado = revendedorBO::getRevendedor($dataGet['nid']);
        $token = FUNCOES::cryptografar($dataGet['nid'] . $dado['senha']);
        if ($token !== $dataGet['token']) {
            throw new Exception('Parâmetros incorretos !!!');
        }
    } elseif ($dataGet['nivel'] == "usuario") {
        $dado = usuarioBO::getUsuario($dataGet['nid']);
        $token = FUNCOES::cryptografar($dataGet['nid'] . $dado->passwlogin);
        if ($token !== $dataGet['token']) {
            throw new Exception('Parâmetros incorretos !!!');
        }
    } else {
        throw new Exception('Parâmetros incorretos !!!');
    }
} catch (Exception $e) {
    $response['error'][] = $e->getMessage();
include_once '../sealed/init.php';
require_once '../sealed/BO/usuarioBO.php';
require_once '../sealed/BO/plano_assinaturaBO.php';
require_once '../sealed/controler/paginador.php';
include_once "../lib/utils/funcoes.php";
/**
 * autenticações 
 */
if (isset($_SESSION['admin_id'])) {
    require_once '../sealed/BO/usuarioBO.php';
    usuarioBO::checkExpireLogin();
    usuarioBO::checkSession();
} elseif (isset($_SESSION['revenda_id'])) {
    require_once '../sealed/BO/revendedorBO.php';
    revendedorBO::checkExpireLogin();
    revendedorBO::checkSession();
} else {
    header("Location:login.php");
}
/**
 * autenticações 
 */
$filterGET = array('action' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^(excluir|imprimir)\$/")), '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|imprimir|exportar_xls)\$/")), '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 = plano_assinaturaBO::getListaCount();
    if (!$dataGet['page']) {
        $dataGet['page'] = 1;
    }
$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!';
Example #4
0
error_reporting(E_ALL ^ E_NOTICE);
include_once "../sealed/BO/usuarioBO.php";
include_once "../sealed/BO/revendedorBO.php";
include_once "../lib/utils/funcoes.php";
$filter = array('email' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,255}\$/")), 'senha' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,255}\$/")), 'tipo' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array("regexp" => "/^[\\w\\W]{1,30}\$/")));
$dataPost = filter_input_array(INPUT_POST, $filter);
if ($dataPost) {
    $tipo = $dataPost['tipo'];
    unset($dataPost['tipo']);
    try {
        if ($tipo == "admin") {
            usuarioBO::getLoginAdmin($dataPost);
            $response['success'][] = "aguarde...";
            $response['link'][] = "index.php";
        } elseif ($tipo == "revenda") {
            revendedorBO::getLoginRevenda($dataPost);
            $response['success'][] = "aguarde...";
            $response['link'][] = "index.php";
        } else {
            $response['error'][] = "a fazer !!!";
        }
    } catch (Exception $e) {
        $response['error'][] = $e->getMessage();
    }
}
if (FUNCOES::isAjax()) {
    print json_encode($response);
    exit;
}
?>
<!DOCTYPE html>
                     */
                    $endereco = serialize($data_endereco);
                    $data['endereco'] = $endereco;
                    unset($data['revenda_id']);
                    $revenda_id = revendedorBO::salvar($data, 'revenda');
                    $response['success'][] = 'Revenda inserido com sucesso!!';
                }
                $response['link'][] = "revenda.php?page={$page}";
            }
        }
    }
    /**
     * Editar fornecedor
     */
    if ($dataGet['revenda_id']) {
        $data = revendedorBO::getRevendedor($dataGet['revenda_id']);
        $endereco = unserialize($data['endereco']);
        $data['data_nascimento'] = FUNCOES::formatarDatatoHTML($data['data_nascimento']);
    }
} catch (Exception $ex) {
    $response['error'][] = $ex->getMessage();
}
if (FUNCOES::isAjax()) {
    print json_encode($response);
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <title><?php 
Example #6
0
$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) {
                    $response['error'][] = $err->getMessage();
                }
            }
        }
    }
    if (!$dataGet['page']) {
        $dataGet['page'] = 1;
    }