public function RelPatrimonio()
 {
     $array_data = explode('/', $data);
     $data = mktime(0, 0, 0, $array_data[1], $array_data[0], $array_data[2]);
     $sql = "SELECT\n          A.codigo_patrimonio, A.descricao,\n          A.data, A.quantidade , A.valor,\n          A.codigo_professor , B.nome\n          FROM pilates.patrimonio AS A\n          LEFT JOIN pilates.professor AS B ON (A.codigo_professor = B.codigo_professor)\n          WHERE A.apagado = 0\n          ORDER BY A.codigo_patrimonio DESC  ";
     //echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
Exemple #2
0
function get_kartukeluarga_id($nik)
{
    $sql = "select keluarga_id from penduduk where nik = '{$nik}'";
    $connection = MysqlManager::get_connection();
    $result = $connection->query($sql);
    check_error($connection);
    $row = $result->fetch_object();
    MysqlManager::close_connection($connection);
    return $row->keluarga_id;
}
function get_alamat_id($sql)
{
    if (strlen($sql) == 0) {
        return "";
    }
    $conn = MysqlManager::get_connection();
    $result = $conn->query($sql);
    $row = $result->fetch_array();
    MysqlManager::close_connection($conn);
    return $row['id'];
}
 public function get_penduduk_id($nik)
 {
     $connection = MysqlManager::get_connection();
     $result = $connection->query("select id from penduduk where nik = '{$nik}'");
     $id = null;
     if ($result) {
         $row = $result->fetch_object();
         $id = $row->id;
     }
     MysqlManager::close_connection($connection);
     return $id;
 }
Exemple #5
0
 function retrieve_data()
 {
     $connection = MysqlManager::get_connection();
     $result = $connection->query($this->sql);
     check_error($connection);
     $row = $result->fetch_object();
     $this->nik = $row->nik;
     $this->nama = $row->nama;
     $this->jenis_kelamin = $row->jenis_kelamin;
     $this->photo = $row->photo;
     $this->status_nikah = $row->status_nikah;
     $this->gol_darah = $row->gol_darah;
     $this->tempat_lahir = $row->tmp_lahir;
     $this->tgl_lahir = $row->tgl_lahir;
     $this->agama = $row->agama;
     $this->pendidikan = $row->pendidikan;
     $this->pekerjaan = $row->pekerjaan;
     $this->keluarga_id = $row->keluarga_id;
     $this->wni = $row->wni;
     // --
     $sql = "select alamat_id from keluarga where id = {$this->keluarga_id}";
     $result = $connection->query($sql);
     check_error($connection);
     $alamat_id = $result->fetch_object()->alamat_id;
     $sql = "select a.alamat as alamat, a.rukun_tetangga as rt, a.rukun_warga as rw,\r\r\n            kel.nama_kelurahan as kelurahan, kec.nama_kecamatan as kecamatan, kec.kodepos as kodepos \r\r\n            from alamat a, kelurahan kel, kecamatan kec where a.id = {$alamat_id} and a.kelurahan_id = kel.id and\r\r\n            kel.kecamatan_id = kec.id ";
     $result = $connection->query($sql);
     check_error($connection);
     $row = $result->fetch_object();
     $this->alamat = $row->alamat;
     $this->rt = $row->rt;
     $this->rw = $row->rw;
     $this->kelurahan = $row->kelurahan;
     $this->kecamatan = $row->kecamatan;
     $this->kodepos = $row->kodepos;
     MysqlManager::close_connection($connection);
 }
Exemple #6
0
            break;
        case "edit":
            $username = $_POST['username'];
            $password = $_POST['password'];
            $id = $_POST['id'];
            $sql = "update users set username = '******', password = password('{$password}') where id = {$id}";
            $connection->query($sql);
            check_error($connection);
            MysqlManager::close_connection($connection);
            break;
        case "del":
            $id = $_POST['id'];
            $sql = "delete from users where id = {$id}";
            $connection->query($sql);
            check_error($connection);
            MysqlManager::close_connection($connection);
            break;
    }
}
if (isset($_POST['data'])) {
    $data_request = $_POST['data'];
    switch ($data_request) {
        case 1:
            // already exist a user
            if (isset($_SESSION['user'])) {
                $menus = retrieve_menus();
                $user = $_SESSION['user'];
                $resp = array('result' => 1, 'menu' => $menus, 'user' => $user);
                echo json_encode($resp);
            } else {
                // no user exist in session
 public function EditarUsuario($id, $nome, $senha)
 {
     $sql = "UPDATE usuarios SET USUARIO_NOME = '{$nome}', USUARIO_SENHA = '{$senha}' WHERE id = '{$id}'";
     //echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
 function headerPDF()
 {
     global $app_strings;
     global $pdfFontSize, $pdfColors;
     $headerLblCol = $pdfColors["headerLbl"];
     $headerFldCol = $pdfColors["headerFld"];
     $headerBg = $pdfColors["field"];
     $headerFontSize = $pdfFontSize["header"];
     $datab = new MysqlManager();
     $datab->connect();
     $q = "SELECT logo, country, city, state, street, phone, fax, web, email FROM companyinfo";
     $res = $datab->query($q, true, " Error filling in additional detail fields: ");
     $r = mysql_fetch_array($res);
     $header = null;
     $header .= "<img width=212px height=40px src=include/images/company_logo_pdf.jpg>";
     $header .= "<br /><br /><hr>";
     $header .= "<table cellspacing=0 cellpadding=0 width=100% bgcolor={$headerBg}>";
     $header .= "<tr><td><font size={$headerFontSize}>";
     $header .= "<font color={$headerLblCol}>" . $app_strings['LBL_ADDRESS'] . ":</font>&nbsp;<font color={$headerFldCol}>" . $r['street'] . ", " . $r['city'] . ", " . $r['country'] . "</font>&nbsp;";
     $header .= "<font color={$headerLblCol}>" . $app_strings['LBL_PHONE'] . ":</font>&nbsp;<font color={$headerFldCol}>" . $r['phone'] . "</font>,&nbsp;";
     $header .= "<font color={$headerLblCol}>" . $app_strings['LBL_FAX'] . ":</font>&nbsp;<font color={$headerFldCol}>" . $r['fax'] . "</font>,&nbsp;";
     $header .= "<font color={$headerLblCol}>" . $app_strings['LBL_WWW'] . ":</font>&nbsp;<font color={$headerFldCol}>" . $r['web'] . "</font>,&nbsp;";
     $header .= "<font color={$headerLblCol}>" . $app_strings['LBL_EMAIL'] . ":</font>&nbsp;<font color={$headerFldCol}>" . $r['email'] . "</font>";
     $header .= "</font></td></tr></table>";
     return $header;
 }
 /**
  * will quote the strings of the passed in array
  * The array must only contain strings
  *
  * @param ARRAY $array
  * @param unknown_type $isLike
  */
 function arrayQuote(&$array, $isLike = true)
 {
     for ($i = 0; $i < count($array); $i++) {
         $array[$i] = MysqlManager::quote($array[$i], $isLike);
     }
 }
 /**
  * @see MysqlManager::query()
  */
 public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $autofree = false)
 {
     static $queryMD5 = array();
     parent::countQuery($sql);
     $GLOBALS['log']->info('Query:' . $sql);
     $this->checkConnection();
     //$this->freeResult();
     $this->query_time = microtime(true);
     $this->lastsql = $sql;
     if ($suppress == true) {
     } else {
         $result = mysqli_query($this->database, $sql);
     }
     $md5 = md5($sql);
     if (empty($queryMD5[$md5])) {
         $queryMD5[$md5] = true;
     }
     $this->lastmysqlrow = -1;
     $this->query_time = microtime(true) - $this->query_time;
     $GLOBALS['log']->info('Query Execution Time:' . $this->query_time);
     // This is some heavy duty debugging, leave commented out unless you need this:
     /*
     $bt = debug_backtrace();
     for ( $i = count($bt) ; $i-- ; $i > 0 ) {
         if ( strpos('MysqliManager.php',$bt[$i]['file']) === false ) {
             $line = $bt[$i];
         }
     }
     
     $GLOBALS['log']->fatal("${line['file']}:${line['line']} ${line['function']} \nQuery: $sql\n");
     */
     $this->checkError($msg . ' Query Failed: ' . $sql, $dieOnError);
     if ($autofree) {
         $this->lastResult[] =& $result;
     }
     return $result;
 }
 public function RelProfessor()
 {
     $sql = "SELECT codigo_professor, nome, telefone_celular,\n          endereco,bairro,crefito FROM pilates.professor WHERE apagado = 1\n          ORDER BY codigo_professor DESC";
     //echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
 public function ExcluirProfessor($id)
 {
     $sql = "UPDATE pilates.professor SET apagado = 0  where codigo_professor = '{$id}'";
     //echo $sql;
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
Exemple #13
0
 /**
  * @see MysqlManager::query()
  */
 public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $autofree = false)
 {
     static $queryMD5 = array();
     parent::countQuery($sql);
     //$GLOBALS['log']->info('Query:' . $sql);
     $this->checkConnection();
     //$this->freeResult();
     $this->query_time = microtime(true);
     $this->lastsql = $sql;
     if ($suppress == true) {
     } else {
         $result = mysqli_query($this->database, $sql);
     }
     $md5 = md5($sql);
     if (empty($queryMD5[$md5])) {
         $queryMD5[$md5] = true;
     }
     $this->lastmysqlrow = -1;
     $this->query_time = microtime(true) - $this->query_time;
     //$GLOBALS['log']->info('Query Execution Time:'.$this->query_time);
     //$this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError);
     $this->checkError($msg . ' Failed:::', 'SQL');
     if ($autofree) {
         $this->lastResult[] =& $result;
     }
     return $result;
 }
Exemple #14
0
 private function get_orang_tua($id)
 {
     $resp = array();
     if (strlen($id) > 0) {
         $sql = "select p.nama as ayah, pp.nama as ibu from penduduk p, penduduk pp,\r\n            orang_tua o where p.id = o.bapak_id and pp.id = o.ibu_id and o.id = {$id}";
         $conn = MysqlManager::get_connection();
         $result = $conn->query($sql);
         check_error($conn);
         $row = $result->fetch_object();
         $resp["ayah"] = $row->ayah;
         $resp["ibu"] = $row->ibu;
         MysqlManager::close_connection($conn);
     } else {
         $resp["ayah"] = "";
         $resp["ibu"] = "";
     }
     return $resp;
 }
 public function EditarVigario($id, $destaque, $noticia)
 {
     $sql = "UPDATE sjbb.sjbb_palavravigario SET PALAVRAVIGARIO_TITULO='{$destaque}', PALAVRAVIGARIO_DESCRICAO='{$noticia}' WHERE PALAVRAVIGARIO_ID='{$id}'";
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
 public function ExibirIdProfissional()
 {
     $sql = "SELECT A.IDCURRICULO AS IDCURRICULO , B.IDEXPERIENCIAPROFISSIONAL AS PROFISSIONAL FROM posgraduacao.tblcurriculos AS A\n          LEFT JOIN posgraduacao.tblexperienciaprofissional AS B ON (A.IDCURRICULO = B.IDCURRICULO) ";
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
 public function ApagarArtigos($id)
 {
     $sql = "UPDATE posgraduacao.tblartigos SET APAGADO = 1 WHERE IDARTIGO = '{$id}'";
     // echo $sql;
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
Exemple #18
0
 public function retrieve_data()
 {
     $conn = MysqlManager::get_connection();
     $sql = "select n.no_pernikahan as nomor_pernikahan, n.tanggal as tanggal,\n        n.wali as wali, p.nama as pria, p.wni as wni_pria, a.agama as agama_pria,\n        pp.nama as wanita, pp.wni as wni_wanita, aa.agama as agama_wanita from pernikahan n,\n        penduduk p, penduduk pp, agama a, agama aa where n.id = {$this->id} and\n        n.pria = p.id and n.wanita = pp.id and p.agama_id = a.id and pp.agama_id = aa.id";
     $result = $conn->query($sql);
     check_error($conn);
     $row = $result->fetch_object();
     $this->pria = $row->pria;
     $this->no_pernikahan = $row->nomor_pernikahan;
     $this->tanggal_menikah = $row->tanggal;
     $this->wali = $row->wali;
     $this->pria_agama = $row->agama_pria;
     $this->pria_wni = $row->wni_pria;
     $this->wanita = $row->wanita;
     $this->wanita_agama = $row->agama_wanita;
     $this->wanita_wni = $row->wni_wanita;
     MysqlManager::close_connection($conn);
 }
Exemple #19
0
 public function retrieve_data()
 {
     $conn = MysqlManager::get_connection();
     $sql = "select p.nik as nik, p.nama as nama, p.tmp_lahir as tempat_lahir, p.tgl_lahir as tgl_lahir, \r\n        p.jenis_kelamin as jenis_kelamin, p.wni as wni, \r\n        a.no_akta as no_akta, a.created_at as tanggal_pembuatan, pp.nama as ayah, ppp.nama as ibu \r\n        from penduduk p, penduduk pp, penduduk ppp, akta_kelahiran a, orang_tua o where p.id = " . $this->id . " and p.id = a.penduduk_id and p.orangtua_id = o.id and o.bapak_id = pp.id and o.ibu_id = ppp.id";
     $result = $conn->query($sql);
     check_error($conn);
     $row = $result->fetch_object();
     $this->nik = $row->nik;
     $this->nama = $row->nama;
     $this->tempat_lahir = $row->tempat_lahir;
     $this->tanggal_lahir = $row->tgl_lahir;
     $this->jenis_kelamin = $row->jenis_kelamin;
     $this->wni = $row->wni;
     $this->no_akta = $row->no_akta;
     $this->tanggal_pembuatan = $row->tanggal_pembuatan;
     $this->ayah = $row->ayah;
     $this->ibu = $row->ibu;
     MysqlManager::close_connection($conn);
 }
 /**
  * @see MysqlManager::query()
  */
 protected function queryMulti($sql, $dieOnError = false, $msg = '', $suppress = false, $keepResult = false, $multiquery = true)
 {
     if (is_array($sql)) {
         return $this->queryArray($sql, $dieOnError, $msg, $suppress);
         //queryArray does not support any return sets
     }
     static $queryMD5 = array();
     parent::countQuery($sql);
     $GLOBALS['log']->info('Query:' . $sql);
     $this->checkConnection();
     $this->query_time = microtime(true);
     $this->lastsql = $sql;
     if ($multiquery) {
         $query_result = $suppress ? @mysqli_multi_query($this->database, $sql) : mysqli_multi_query($this->database, $sql);
         $result = mysqli_use_result($this->database);
         // Clear any remaining recordsets
         while (mysqli_next_result($this->database)) {
             $tmp_result = mysqli_use_result($this->database);
             mysqli_free_result($tmp_result);
         }
     } else {
         $result = $suppress ? @mysqli_query($this->database, $sql) : mysqli_query($this->database, $sql);
     }
     $md5 = md5($sql);
     if (empty($queryMD5[$md5])) {
         $queryMD5[$md5] = true;
     }
     $this->query_time = microtime(true) - $this->query_time;
     $GLOBALS['log']->info('Query Execution Time:' . $this->query_time);
     // slow query logging
     if ($this->dump_slow_queries($sql)) {
         $this->track_slow_queries($sql);
     }
     // This is some heavy duty debugging, leave commented out unless you need this:
     /*
       $bt = debug_backtrace();
       $line['file'] = 'NO_FILE';
       $line['line'] = 'NO_LINE';
       $line['function'] = 'NO_FUNCTION';
       $i = 0;
       foreach ( $bt as $i => $tryLine ) {
           if ( strpos($tryLine['file'],'include/database') === false && strpos($tryLine['file'],'include/SugarQuery') === false ) {
               $line = $tryLine;
               // Go function line up to find the real function
               if ( isset($bt[($i+1)]['function']) ) {
                   $line['function'] = $bt[($i+1)]['function'];
               }
               break;
           }
       }
     $dumpQuery = str_replace(array('      ','     ','    ','   ','  ',"\n","\t","\r"),
                              array(' ',     ' ',    ' ',   ' ',  ' ', ' ', ' ', ' ',),
                              $sql);
     
     $GLOBALS['log']->fatal("{$line['file']}:{$line['line']} ${line['function']} \nQuery: $dumpQuery\n");
     */
     if ($keepResult) {
         $this->lastResult = $result;
     }
     if ($this->database && mysqli_errno($this->database) == 2006 && $this->retryCount < 1) {
         $GLOBALS['log']->fatal('mysqli has gone away, retrying');
         $this->retryCount++;
         $this->disconnect();
         $this->connect();
         return $this->query($sql, $dieOnError, $msg, $suppress, $keepResult);
     } else {
         $this->retryCount = 0;
     }
     $this->checkError($msg . ' Query Failed: ' . $sql, $dieOnError);
     return $result;
 }
$res = $datab->query($q, true, " Error filling in additional detail fields: ");
$r = mysql_fetch_array($res);
$sugar_smarty->assign('CI', $r);
///////////////////////////////////////////////////////////////////////////////
////    HANDLE CHANGES
if (isset($_REQUEST['process']) && $_REQUEST['process'] == 'true') {
    $logo = $_REQUEST['logo'];
    $country = $_POST['country'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $street = $_POST['street'];
    $phone = $_POST['phone'];
    $fax = $_POST['fax'];
    $web = $_POST['web'];
    $email = $_POST['email'];
    $datab = new MysqlManager();
    $datab->connect();
    $q = "SELECT * FROM `companyinfo`";
    $res = $datab->query($q, true, " Error filling in additional detail fields: ");
    $num = $datab->getRowCount($result);
    if ($num = 0) {
        $query = 'INSERT into companyinfo (logo, country, city, state, street, phone, fax, web, email) VALUES';
        $query .= "('{$logo}', '{$country}', '{$city}', '{$state}', '{$street}', '{$phone}', '{$fax}', '{$web}', '{$email}') ";
        $result = $datab->query($query, true, " Error filling in additional detail fields: ");
    } else {
        $query = "UPDATE companyinfo SET    logo = '{$logo}' , \n                                            country = '{$country}' , \n                                            city = '{$city}', \n                                            state = '{$state}', \n                                            street = '{$street}', \n                                            phone = '{$phone}', \n                                            fax = '{$fax}', \n                                            web = '{$web}', \n                                            email = '{$email}'";
        $result = $datab->query($query, true, " Error filling in additional detail fields: ");
    }
    $cfg->populateFromPost();
    $cfg->handleOverride();
}
Exemple #22
0
 public function RelAlunos()
 {
     $sql = "SELECT \n          A.codigo_paciente, A.nome as aluno,\n          A.telefone_fixo, A.telefone_celular,\n          A.endereco, A.bairro,\n          A.numero, \n          B.nome as Nome_Professor\n          FROM pilates.paciente as A\n          LEFT JOIN pilates.professor as B ON (A.codigo_professor = B.codigo_professor)\n          WHERE A.apagado = 0 \n          ORDER BY A.codigo_paciente DESC";
     //echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
 public static function ExecutaConsultaMysql($sql, $db)
 {
     //echo "sql MysqlManager:$sql no DB $db<br>";
     $result = MysqlManager::mysqlQuery($sql, $db);
     return MysqlManager::CarregaVariaveisMysql($result);
 }
Exemple #24
0
 public function RelLog()
 {
     $sql = "SELECT\n          A.codigo_professor,\n          B.nome AS PROFESSOR,\n          A.codigo_mensalidade,\n          A.data_alteracao,\n          A.aluno,\n          C.codigo_paciente,\n          C.nome as ALUNO,\n          A.regapagado,\n          A.regusuario\n          FROM pilates.log as A\n          LEFT JOIN pilates.professor AS B ON (B.codigo_professor = A.codigo_professor)\n          LEFT JOIN pilates.paciente AS C ON (C.codigo_paciente = A.aluno)\n          ORDER BY A.codigo_mensalidade DESC";
     //   echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }
 public function ApagarUsuario($id)
 {
     $sql = "UPDATE posgraduacao.tblusuarios SET APAGADO = 1 WHERE IDUSUARIO = '{$id}'";
     // echo $sql;
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
 public function ExcluirDicas($id)
 {
     $sql = "UPDATE posgraduacao.tbldicas SET APAGADO = 1 WHERE IDDICA = '{$id}'";
     echo $sql;
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
 public function ExcluirCurso($id)
 {
     $sql = "UPDATE posgraduacao.tblcursos SET apagado = 1  where IDCURSO = '{$id}'";
     //echo $sql;
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
 public function ApagarPresenca($id)
 {
     $sql = "UPDATE  pilates.presenca SET apagado = 1 WHERE codigo_presenca = '{$id}'";
     return MysqlManager::ExecutaPersistenciaMysql($sql, $this->db);
 }
 /**
  * 
  * 批量转义字符串
  * @param array $arrFields 要转义的数组
  * @param array $arrStrFields 哪些KEY是字符串类型的
  */
 public static function escapeStrings(&$arrFields, $arrStrFields = null)
 {
     $db = new MysqlManager();
     if (false === $db->fetchMysqlHandler(null, 0)) {
         KC_LOG_WARNING::waning(__FUNCTION__ . ' failed, fetch mysql handler failed [ dbNo: 0, arrFields: ' . json_encode($arrFields) . ', arrStrFields: ' . json_encode($arrStrFields) . ' ].');
         return false;
     }
     foreach ($arrFields as $k => &$v) {
         if (is_null($arrStrFields)) {
             !is_null($v) && ($v = "'" . $db->escapeString($v) . "'");
             continue;
         }
         in_array($k, $arrStrFields) && !is_null($v) && ($v = "'" . $db->escapeString($v) . "'");
     }
     return true;
 }
 public function EventosMaxId()
 {
     $sql = "SELECT MAX(IDEVENTOFOTO) AS ULTIMO FROM posgraduacao.tbleventofotos";
     //	echo $sql;
     return MysqlManager::ExecutaConsultaMysql($sql, $this->db);
 }