session_start();
if (!isset($login)) {
    if (!isset($DB_LOGADO)) {
        session_destroy();
    } else {
        session_register("DB_acesso");
    }
} else {
    session_register("DB_acesso");
}
include "libs/db_conecta.php";
include_once "functions/func_sys.php";
include "libs/db_stdlib.php";
include "libs/db_sql.php";
require_once "libs/db_encriptacao.php";
mens_help();
db_mensagem("corpoprincipal", "mensagemsenha");
db_fieldsmemory($result, 0);
parse_str(base64_decode($HTTP_SERVER_VARS["QUERY_STRING"]));
if (isset($again)) {
    db_logs("", "", "0", "index.php - usuario fez log-off.");
    db_redireciona("index.php");
}
if (isset($login)) {
    $sSql = "select db_usuarios.id_usuario, senha, u.cgmlogin, usuarioativo         ";
    $sSql .= "  from db_usuarios                                                     ";
    $sSql .= "       inner join db_usuacgm u on u.id_usuario = db_usuarios.id_usuario";
    $sSql .= " where login        = '******'                                      ";
    $sSql .= "   and usuext       = 1                                                ";
    $result = db_query($conn, $sSql);
    if (pg_numrows($result) == 0) {
include "libs/db_conecta.php";
include "libs/db_stdlib.php";
include "libs/db_sql.php";
include "classes/db_imobil_classe.php";
include "classes/db_iptubase_classe.php";
$climobil = new cl_imobil();
$cliptubase = new cl_iptubase();
parse_str(base64_decode($HTTP_SERVER_VARS["QUERY_STRING"]));
$result = pg_exec("SELECT distinct m_publico,m_arquivo,m_descricao\n                       FROM db_menupref \n                       WHERE m_arquivo = 'digitamatricula.php'\n                       ORDER BY m_descricao\n                       ");
db_fieldsmemory($result, 0);
if ($m_publico != 't') {
    if (!session_is_registered("DB_acesso")) {
        echo "<script>location.href='index.php?" . base64_encode('erroscripts=3') . "'</script>";
    }
}
mens_help('digitamatricula.php');
db_mensagem("imovel_cab", "imovel_rod");
//$db_verificaip = db_verifica_ip();
//if($db_verificaip == "0"){
$onsubmit = "onsubmit=\"return js_verificaCGCCPF((this.cgc.value==''?'':this.cgc),this.cpf);\"";
//}else{
//  $onsubmit = "";
//}
?>
<html>
<head>
<title><?php 
echo $w01_titulo;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">