Esempio n. 1
0
function TampilkanJadwalDosen()
{
    $s = "select j.*, h.Nama as HR\n    from jadwal j\n      left outer join hari h on j.HariID=h.HariID\n    where j.DosenID='{$_SESSION['dosen']}'\n    and j.TahunID='{$_SESSION['tahun']}'\n    order by j.HariID, j.JamMulai, j.MKKode";
    $r = _query($s);
    // Tampilkan
    $nomer = 0;
    $hari = -1;
    $totsks = 0;
    $hdrjdwl = "<tr><th class=ttl>No</th>\n    <th class=ttl>Jam</th>\n    <th class=ttl>Ruang</th>\n    <th class=ttl>Kode MK</th>\n    <th class=ttl>Matakuliah</th>\n    <th class=ttl>Kelas</th>\n    <th class=ttl>SKS</th>\n    <th class=ttl>Prodi</th>\n    <th class=ttl>Dosen</th>\n    <th class=ttl title='Presensi'>Prs</th>\n    <th class=ttl>Link</th>\n    </tr>";
    echo "<p><table class=box cellspacing=1 cellpadding=4>";
    while ($w = _fetch_array($r)) {
        if ($hari != $w['HariID']) {
            $hari = $w['HariID'];
            echo "<tr><td class=ul colspan=12><b>{$w['HR']}</b></td></tr>";
            echo $hdrjdwl;
        }
        $nomer++;
        $totsks += $w['SKS'];
        // Array dosen
        $arrdosen = explode('.', TRIM($w['DosenID'], '.'));
        $strdosen = implode(',', $arrdosen);
        $_dosen = empty($strdosen) ? '' : GetArrayTable("select Nama from dosen where Login in ({$strdosen}) order by Nama", "Login", "Nama", '<br />');
        // Array prodi
        $arrprodi = explode('.', TRIM($w['ProdiID'], '.'));
        $strprodi = implode(',', $arrprodi);
        $_prodi = empty($strprodi) ? '' : GetArrayTable("select Nama from prodi where ProdiID in ({$strprodi}) order by ProdiID", "ProdiID", "Nama", '<br />');
        echo "<tr><td class=inp1>{$nomer}</td>\n      <td class=ul>{$w['JamMulai']}-{$w['JamSelesai']}</td>\n      <td class=ul>{$w['RuangID']}</td>\n      <td class=ul>{$w['MKKode']}</td>\n      <td class=ul>{$w['Nama']}</td>\n      <td class=ul>{$w['NamaKelas']}&nbsp;</td>\n      <td class=ul>{$w['SKS']} ({$w['SKSAsli']})</td>\n      <td class=ul>{$_prodi}</td>\n      <td class=ul>{$_dosen}</td>\n      <td class=ul align=right>{$w['Kehadiran']}</td>\n      <td class=ul><a href='?mnux=dosen.nilai&tahun={$_SESSION['tahun']}&jadwalid={$w['JadwalID']}&dosen={$_SESSION['dosen']}'>Nilai</a></td>\n      </tr>";
    }
    echo "<tr><td colspan=6 align=right>Total SKS :</td><td class=cnnY align=right><b>{$totsks}</b></td></tr>\n    </table></p>";
}
Esempio n. 2
0
 /**
  * Save method for groups admin
  * @param string $mode: edit if coming from edit, add if coming from add
  */
 function saveStories($mode)
 {
     //The current user
     $userId = $this->objUser->userId();
     //Get data from form
     $category = TRIM($this->getParam('category', NULL));
     $isActive = TRIM($this->getParam('isActive', NULL));
     $parentId = TRIM($this->getParam('parentId', NULL));
     //Set Id to default if missing
     if ($parentId == '') {
         $parentId = 'base';
     }
     $language = TRIM($this->getParam('language', NULL));
     $title = TRIM($this->getParam('title', NULL));
     $abstract = TRIM($this->getParam('abstract', NULL));
     $mainText = TRIM($this->getParam('mainText', NULL));
     $isSticky = TRIM($this->getParam('isSticky', NULL));
     $forceOrder = TRIM($this->getParam('forceOrder', NULL));
     $expirationDate = TRIM($this->getParam('expirationDate', NULL));
     // if edit use update
     if ($mode == "edit") {
         $rsArray = array('category' => $category, 'parentId' => $parentId, 'language' => $language, 'isActive' => $isActive, 'title' => $title, 'abstract' => $abstract, 'mainText' => $mainText, 'isSticky' => $isSticky, 'modifierId' => $userId, 'dateModified' => date('Y-m-d H:m:s'), 'expirationDate' => $expirationDate);
         $id = TRIM($this->getParam('id', NULL));
         $this->update("id", $id, $rsArray);
     } elseif ($mode == "add" || ($mode = "translate")) {
         $this->insert(array('category' => $category, 'parentId' => $parentId, 'language' => $language, 'isActive' => $isActive, 'title' => $title, 'abstract' => $abstract, 'mainText' => $mainText, 'isSticky' => $isSticky, 'creatorId' => $userId, 'dateCreated' => date('Y-m-d H:m:s'), 'expirationDate' => $expirationDate));
     }
 }
Esempio n. 3
0
function ProsesBeneran()
{
    global $arrprodi;
    $strprd = '';
    foreach ($arrprodi as $val) {
        $strprd .= ",'{$val}'";
    }
    $strprd = TRIM($strprd, ',');
    $s = "select khs.MhswID, khs.ProdiID, khs.KHSID\r\n    from khs\r\n    where khs.ProdiID in ({$strprd}) and khs.TahunID='{$_SESSION['tahun']}'\r\n    order by khs.MhswID";
    $r = _query($s);
    $jml = _num_rows($r);
    $_SESSION['CEK-KRS-JML'] = $jml;
    $_SESSION['CEK-KRS-POS'] = 0;
    echo "<p>Ada terdaftar <font size=+1>{$jml}</font> mhsw.</p>";
    $n = 0;
    while ($w = _fetch_array($r)) {
        $n++;
        $_SESSION["CEK-KRS-MHSWID-{$n}"] = $w['MhswID'];
        $_SESSION["CEK-KRS-PRODIID-{$n}"] = $w['ProdiID'];
        $_SESSION["CEK-KRS-KHSID-{$n}"] = $w['KHSID'];
    }
    $_SESSION["CEK-KRS-JML"] = $n;
    $_SESSION["CEK-KRS-DIHAPUS"] = 0;
    // IFRAME
    echo "<p><IFRAME src='_Cek_KRS_Double.gos.php' frameborder=0 height=100% width=100%>\r\n  </IFRAME></p>";
}
Esempio n. 4
0
function inverseHex($color)
{
    $color = TRIM($color);
    $prependHash = FALSE;
    if (STRPOS($color, '#') !== FALSE) {
        $prependHash = TRUE;
        $color = STR_REPLACE('#', NULL, $color);
    }
    switch ($len = STRLEN($color)) {
        case 3:
            $color = PREG_REPLACE("/(.)(.)(.)/", "\\1\\1\\2\\2\\3\\3", $color);
        case 6:
            break;
        default:
            TRIGGER_ERROR("Invalid hex length ({$len}). Must be (3) or (6)", E_USER_ERROR);
    }
    if (!PREG_MATCH('/[a-f0-9]{6}/i', $color)) {
        $color = HTMLENTITIES($color);
        TRIGGER_ERROR("Invalid hex string #{$color}", E_USER_ERROR);
    }
    $r = DECHEX(255 - HEXDEC(SUBSTR($color, 0, 2)));
    $r = STRLEN($r) > 1 ? $r : '0' . $r;
    $g = DECHEX(255 - HEXDEC(SUBSTR($color, 2, 2)));
    $g = STRLEN($g) > 1 ? $g : '0' . $g;
    $b = DECHEX(255 - HEXDEC(SUBSTR($color, 4, 2)));
    $b = STRLEN($b) > 1 ? $b : '0' . $b;
    return ($prependHash ? '#' : NULL) . $r . $g . $b;
}
function InsertarPeritajeNuevo($txtFechaAsignacion, $txtFechaPericia, $txtFVencImpug, $cmbPericia, $txtResultados, $nrojuicio, $usuario, $incapacidadDemanda, $incapacidadPeritoMedico, $ibmArt, $ibmPericial, $impugnacion, $idperito)
{
    try {
        global $conn;
        $peritajeid = GetSecNextValOracle('legales.seq_lpj_id');
        $montodemanda = $incapacidadDemanda;
        $montomedico = $incapacidadPeritoMedico;
        $montoart = $ibmArt;
        $montopericial = $ibmPericial;
        $sqlInsert = " INSERT INTO legales.lpj_peritajejuicio \n             (pj_id, PJ_IDPERITO, pj_fechanotificacion, \n              pj_fechaperitaje, pj_fechavencimpugnacion, \n              pj_resultadoperitaje, pj_fechaalta, \n              pj_usualta, pj_idjuicioentramite, \n              pj_idtipopericia, pj_incapacidaddemanda, \n              pj_incapacidadperitomedico, pj_ibmart, \n              pj_ibmpericial, pj_impugnacion \n             ) \n      VALUES (\t:pj_id, \n      \t\t\t:pj_IDPERITO,\n      \t\t\tTO_DATE(:pj_fechanotificacion, 'DD/MM/YYYY'), \n      \t\t\tTO_DATE(:pj_fechaperitaje, 'DD/MM/YYYY'), \n      \t\t\tTO_DATE(:pj_fechavencimpugnacion, 'DD/MM/YYYY'), \n\t            TRIM(:pj_resultadoperitaje), \n\t            SYSDATE, \n\t            :pj_usualta, \n\t            :pj_idjuicioentramite, \n\t\t\t\tTO_NUMBER(:pj_idtipopericia), \n\t\t\t\tTO_NUMBER(:pj_incapacidaddemanda), \n\t\t\t\tTO_NUMBER(:pj_incapacidadperitomedico), \n\t\t\t\tTO_NUMBER(:pj_ibmart), \n\t\t\t\tTO_NUMBER(:pj_ibmpericial), \n\t\t\t\t:pj_impugnacion )";
        /*
        $txtFechaAsignacion = GetStrToDate($txtFechaAsignacion);
        $txtFechaPericia = GetStrToDate($txtFechaPericia);	
         	$txtFVencImpug = GetStrToDate($txtFVencImpug);
        */
        $cmbPericia = (int) $cmbPericia;
        $montodemanda = Getfloat($montodemanda);
        $montomedico = Getfloat($montomedico);
        $montoart = Getfloat($montoart);
        $montopericial = Getfloat($montopericial);
        if (trim($impugnacion) == 'S' or trim($impugnacion) == 'N') {
            $impugnacion = trim($impugnacion);
        } else {
            $impugnacion = '';
        }
        $params = array(":pj_id" => $peritajeid, ":pj_IDPERITO" => $idperito, ":pj_fechanotificacion" => $txtFechaAsignacion, ":pj_fechaperitaje" => $txtFechaPericia, ":pj_fechavencimpugnacion" => $txtFVencImpug, ":pj_resultadoperitaje" => TRIM($txtResultados), ":pj_usualta" => $usuario, ":pj_idjuicioentramite" => $nrojuicio, ":pj_idtipopericia" => $cmbPericia, ":pj_incapacidaddemanda" => $montodemanda, ":pj_incapacidadperitomedico" => $montomedico, ":pj_ibmart" => $montoart, ":pj_ibmpericial" => $montopericial, ":pj_impugnacion" => $impugnacion);
        @DBExecSql($conn, $sqlInsert, $params);
        //----------------------------------------------------------------------
        DBCommit($conn);
        return $peritajeid;
    } catch (Exception $e) {
        DBRollback($conn);
        return 0;
    }
}
 public function cargarCuentas()
 {
     global $conexionbd;
     $this->servidor = $_SESSION['sigesp_servidor_apr'];
     $this->usuario = $_SESSION['sigesp_usuario_apr'];
     $this->clave = $_SESSION['sigesp_clave_apr'];
     $this->basedatos = $_SESSION['sigesp_basedatos_apr'];
     $this->gestor = $_SESSION['sigesp_gestor_apr'];
     $this->tipoconexionbd = 'ALTERNA';
     $this->seleccionarConexion(&$conexionbd);
     $consulta = " SELECT spg_cuenta " . "  FROM saf_catalogo " . " WHERE trim(spg_cuenta)<>'' " . "UNION " . "SELECT spg_cuenta_act as spg_cuenta " . "  FROM saf_activo " . " WHERE trim(spg_cuenta_act)<>'' " . "UNION " . "SELECT spg_cuenta_dep as spg_cuenta " . "  FROM saf_activo " . " WHERE trim(spg_cuenta_dep)<>'' " . "UNION " . "SELECT spg_cuenta " . "  FROM sigesp_cargos " . " WHERE trim(spg_cuenta)<>'' " . "UNION " . "SELECT spg_cuenta " . "  FROM siv_articulo " . " WHERE trim(spg_cuenta)<>'' " . "UNION " . "SELECT spg_cuenta " . "  FROM sep_conceptos " . " WHERE trim(spg_cuenta)<>'' " . "UNION " . "SELECT spg_cuenta " . "  FROM soc_servicios " . " WHERE trim(spg_cuenta)<>'' " . "UNION " . "SELECT cueprecon as spg_cuenta " . "  FROM sno_concepto " . " WHERE trim(cueprecon)<>'' " . "UNION " . "SELECT cueprepatcon as spg_cuenta " . "  FROM sno_concepto " . " WHERE trim(cueprepatcon)<>'' " . "UNION " . "SELECT cueprecon as spg_cuenta " . "  FROM sno_hconcepto " . " WHERE trim(cueprecon)<>'' " . "UNION " . "SELECT cueprepatcon as spg_cuenta " . "  FROM sno_hconcepto " . " WHERE trim(cueprepatcon)<>'' " . " GROUP BY spg_cuenta " . " ORDER BY spg_cuenta ";
     $result = $conexionbd->Execute($consulta);
     if ($result === false) {
         $this->valido = false;
         $cadena = 'Error al Seleccionar las Cuentas Presupuestarias.' . '' . $conexionbd->ErrorMsg();
     } else {
         $arreglo = array();
         $j = 0;
         while (!$result->EOF) {
             $this->spgcuentaorigen = validarTexto($result->fields['spg_cuenta'], 0, 25, '');
             $this->spgcuentadestino = '';
             $arreglo[$j]['origen'] = $result->fields['spg_cuenta'];
             $resultDestino = $this->cargarCuentaDestino();
             if (TRIM($arreglo[$j]['origen']) == TRIM($resultDestino->fields['spg_cuentaorigen'])) {
                 $arreglo[$j]['destino'] = $resultDestino->fields['spg_cuentadestino'];
             } else {
                 $arreglo[$j]['destino'] = '';
             }
             $j++;
             $result->MoveNext();
         }
     }
     return $arreglo;
 }
Esempio n. 7
0
function SQL语句解析函数_应用于消息中心($sql, $操作记录编号)
{
    global $db, $MetaTables;
    //判断自定义表是否存在,如果不存在直接返回
    //判断是否是联合全操作,是否有子查询,是否用left
    //如果有,则表示为手写SQL代码,不是系统生成,则直接返回,不进行过滤
    $sql = trim($sql);
    //转成小写
    $sqllower = strtolower($sqllower);
    //缩进空格
    $sql = eregi_replace("  ", " ", $sql);
    $sql = eregi_replace("  ", " ", $sql);
    if (substr($sqllower, 0, strlen("insert into")) == "insert into") {
        $sqlArray = explode('insert into', $sql);
        $sqlArray = explode('values', $sqlArray[1]);
        $sqlArray = explode('(', $sqlArray[0]);
        $Tablename = $sqlArray[0];
        开始处理消息中心('INSERT', $Tablename, $数据字段, $操作记录编号);
    }
    if (substr($sqllower, 0, strlen("update")) == "update") {
        $sqlArray = explode('update', $sql);
        $sqlArray = explode('set', $sqlArray[1]);
        $Tablename = TRIM($sqlArray[0]);
    }
    if (substr($sqllower, 0, strlen("delete from")) == "delete from") {
        $sqlArray = explode('delete from', $sql);
        $sqlArray = explode(' ', $sqlArray[1]);
        $Tablename = TRIM($sqlArray[0]);
        开始处理消息中心('DELETE', $Tablename, $数据字段, $操作记录编号);
    }
}
Esempio n. 8
0
function DetailBIPOT()
{
    global $_lf;
    $bipotid = $_REQUEST['bipotid'];
    $bpt = GetFields('bipot', 'BIPOTID', $bipotid, '*');
    $prg = GetaField('program', 'ProgramID', $bpt['ProgramID'], 'Nama');
    $prd = GetaField('prodi', 'ProdiID', $bpt['ProdiID'], 'Nama');
    $nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.bipot.dwoprn";
    $f = fopen($nmf, 'w');
    $mxc = 114;
    $grs = str_pad('-', $mxc, '-') . $_lf;
    $hdr = str_pad("Daftar Biaya & Potongan {$bpt['TahunID']}", $mxc, ' ', STR_PAD_BOTH) . $_lf . str_pad($bpt['Nama'], $mxc, ' ', STR_PAD_BOTH) . $_lf . str_pad("Program: {$prg}, Prodi: {$prd}", $mxc, ' ', STR_PAD_BOTH) . $_lf . $grs . "No. Prio " . str_pad("Nama", 30) . str_pad("Jumlah", 12, ' ', STR_PAD_LEFT) . ' ' . str_pad("Penarikan", 12) . str_pad("Oto?", 5) . ' ' . str_pad("St.Awal", 12) . ' ' . str_pad("St.Mhsw", 12) . ' ' . str_pad("Grade", 5) . ' ' . $_lf . $grs;
    $s = "select b2.*, bn.Nama, format(b2.Jumlah, 0) as JML,\r\n      t.Nama as NMTRX, s.Nama as SAAT\r\n      from bipot2 b2\r\n      left outer join bipotnama bn on b2.BIPOTNamaID=bn.BIPOTNamaID\r\n      left outer join saat s on b2.SaatID=s.SaatID\r\n      left outer join trx t on b2.TrxID=t.TrxID\r\n      where b2.BIPOTID='{$bipotid}' and KodeID='{$_SESSION['KodeID']}'\r\n      order by b2.TrxID, b2.Prioritas, b2.GradeNilai";
    $r = _query($s);
    $n = 0;
    fwrite($f, $hdr);
    while ($w = _fetch_array($r)) {
        $n++;
        $jml = number_format($w['Jumlah']);
        $sa = TRIM($w['StatusAwalID'], '.');
        $sa = str_replace('.', ',', $sa);
        $sm = TRIM($w['StatusMhswID'], '.');
        $sm = str_replace('.', ',', $sm);
        fwrite($f, str_pad($n, 4) . str_pad($w['Prioritas'], 5) . str_pad($w['Nama'], 30) . str_pad($jml, 12, ' ', STR_PAD_LEFT) . ' ' . str_pad($w['SAAT'], 12) . str_pad($w['Otomatis'], 5, ' ', STR_PAD_BOTH) . ' ' . str_pad($sa, 12) . ' ' . str_pad($sm, 12) . ' ' . str_pad($w['GradeNilai'], 5, ' ', STR_PAD_BOTH) . $_lf);
    }
    fwrite($f, $grs);
    fclose($f);
    TampilkanFileDWOPRN($nmf);
}
 public function cargarCuentas()
 {
     global $conexionbd;
     $this->servidor = $_SESSION['sigesp_servidor_apr'];
     $this->usuario = $_SESSION['sigesp_usuario_apr'];
     $this->clave = $_SESSION['sigesp_clave_apr'];
     $this->basedatos = $_SESSION['sigesp_basedatos_apr'];
     $this->gestor = $_SESSION['sigesp_gestor_apr'];
     $this->tipoconexionbd = 'ALTERNA';
     $this->seleccionarConexion(&$conexionbd);
     $consulta = " SELECT c_resultad as sc_cuentaorigen" . "  FROM sigesp_empresa " . " WHERE trim(c_resultad)<>'' " . "UNION " . "SELECT c_resultan as sc_cuentaorigen" . "  FROM sigesp_empresa " . " WHERE trim(c_resultan)<>'' " . "UNION " . "SELECT scctaben as sc_cuentaorigen" . "  FROM sigesp_empresa " . " WHERE trim(scctaben)<>'' " . "UNION " . "SELECT c_financiera as sc_cuentaorigen" . "  FROM sigesp_empresa " . " WHERE trim(c_financiera)<>'' " . "UNION " . "SELECT c_fiscal as sc_cuentaorigen" . "  FROM sigesp_empresa " . " WHERE trim(c_fiscal)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM rpc_proveedor " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM rpc_beneficiario " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM saf_activo " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM sigesp_deducciones " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM siv_articulo " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM scb_ctabanco " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM scb_colocacion " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT sc_cuenta as sc_cuentaorigen" . "  FROM sno_beneficiario " . " WHERE trim(sc_cuenta)<>'' " . "UNION " . "SELECT cueconnom as sc_cuentaorigen" . "  FROM sno_nomina " . " WHERE trim(cueconnom)<>'' " . "UNION " . "SELECT cueaboper as sc_cuentaorigen" . "  FROM sno_personalnomina " . " WHERE trim(cueaboper)<>'' " . "UNION " . "SELECT cueconcon as sc_cuentaorigen" . "  FROM sno_concepto " . " WHERE trim(cueconcon)<>'' " . "UNION " . "SELECT cueconpatcon as sc_cuentaorigen" . "  FROM sno_concepto " . " WHERE trim(cueconpatcon)<>'' " . "UNION " . "SELECT cueconnom as sc_cuentaorigen" . "  FROM sno_hnomina " . " WHERE trim(cueconnom)<>'' " . "UNION " . "SELECT cueaboper as sc_cuentaorigen" . "  FROM sno_hpersonalnomina " . " WHERE trim(cueaboper)<>'' " . "UNION " . "SELECT cueconcon as sc_cuentaorigen" . "  FROM sno_hconcepto " . " WHERE trim(cueconcon)<>'' " . "UNION " . "SELECT cueconpatcon as sc_cuentaorigen" . "  FROM sno_hconcepto " . " WHERE trim(cueconpatcon)<>'' " . " GROUP BY sc_cuentaorigen " . " ORDER BY sc_cuentaorigen ";
     $result = $conexionbd->Execute($consulta);
     if ($result === false) {
         $this->valido = false;
         $cadena = 'Error al Seleccionar las Cuentas Contables.' . '' . $conexionbd->ErrorMsg();
     } else {
         $arreglo = array();
         $j = 0;
         while (!$result->EOF) {
             $this->sccuentaorigen = validarTexto($result->fields['sc_cuentaorigen'], 0, 25, '');
             $this->sccuentadestino = '';
             $arreglo[$j]['origen'] = $result->fields['sc_cuentaorigen'];
             $resultDestino = $this->cargarCuentaDestino();
             if (TRIM($arreglo[$j]['origen']) == TRIM($resultDestino->fields['scg_cuentaorigen'])) {
                 $arreglo[$j]['destino'] = $resultDestino->fields['scg_cuentadestino'];
             } else {
                 $arreglo[$j]['destino'] = '';
             }
             $j++;
             $result->MoveNext();
         }
     }
     return $arreglo;
 }
Esempio n. 10
0
function TampilkanDaftarSekolah()
{
    global $Cari;
    $Max = 50;
    $arrcr = explode(',', $Cari);
    $arrwhr = array();
    if (!empty($arrcr[0])) {
        $arrwhr[] = "Nama like '%" . TRIM($arrcr[0]) . "%' ";
    }
    if (!empty($arrcr[1])) {
        $arrwhr[] = "Kota like '%" . TRIM($arrcr[1]) . "%' ";
    }
    $whr = implode(' and ', $arrwhr);
    // Hitung jumlah baris
    $Jml = GetaField('asalsekolah', "{$whr} and NA", 'N', "count(SekolahID)");
    if ($Jml > $Max) {
        $_Jml = number_format($Jml);
        echo "<p><b>Catatan:</b> Jumlah Sekolah yang Anda cari mencapai: <b>{$_Jml}</b>, tetapi sistem membatasi\r\n      jumlah sekolah yang ditampilkan dan hanya menampilkan: <b>{$Max}</b>.\r\n      Gunakan Nama Sekolah dan Kota Sekolah dengan lebih spesifik untuk membatasi\r\n      jumlah sekolah yang ditampilkan.</p>\r\n\r\n      <p><b>Format Pencarian:</b> NamaSekolah, KotaSekolah</p>";
    }
    // Tampilkan
    $s = "select SekolahID, Nama, Kota, JenisSekolahID\r\n    from asalsekolah\r\n    where {$whr} and NA='N'\r\n    order by Nama limit {$Max}";
    $r = _query($s);
    $n = 0;
    echo "<p><table class=box cellspacing=1 cellpadding=4>\r\n    <tr><th class=ttl>#</th>\r\n    <th class=ttl>Kode Sekolah</th>\r\n    <th class=ttl>Nama</th>\r\n    <th class=ttl>Kota</th>\r\n    <th class=ttl>Jenis</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        $n++;
        echo "<tr><td class=ul>{$n}</td>\r\n    <td class=ul><a href='javascript:kembalikan(\"{$w['SekolahID']}\", \"{$w['Nama']}\", \"{$w['Kota']}\")'>{$w['SekolahID']}</a></td>\r\n    <td class=ul>{$w['Nama']}</td>\r\n    <td class=ul>{$w['Kota']}</td>\r\n    <td class=ul>{$w['JenisSekolahID']}</td>\r\n    </tr>";
    }
    echo "</table></p>";
}
Esempio n. 11
0
function TampilkanDaftarDosen()
{
    global $DosenID, $NamaDosen, $prodi;
    $arr = array();
    if (!empty($DosenID)) {
        $arr[] = "Login like '{$DosenID}%' ";
    }
    if (!empty($NamaDosen)) {
        $arr[] = "Nama like '%{$NamaDosen}%' ";
    }
    if (!empty($prodi)) {
        $arr[] = "INSTR(ProdiID, '.{$prodi}.')>0 ";
    }
    $whr = empty($arr) ? '' : " and " . implode(' and ', $arr);
    $s = "select Login, Nama, concat(Nama, ', ', Gelar) as DSN, Homebase, ProdiID\r\n    from dosen\r\n    where NA='N'\r\n      {$whr}\r\n    order by Nama";
    $r = _query($s);
    //echo "<pre>$s</pre>";
    echo "<p><table class=box cellspacing=1 cellpadding=4>\r\n    <tr><th class=ttl>Kode</th>\r\n    <th class=ttl>Nama Dosen</th>\r\n    <th class=ttl>Homebase</th>\r\n    <th class=ttl>Mengajar di</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        $_prd = TRIM($w['ProdiID'], '.');
        $_prd = str_replace('.', ',', $_prd);
        echo "<tr>\r\n      <td class=ul><a href='javascript:kembalikan(\"{$w['Login']}\", \"{$w['Nama']}\")'><img src='img/share.gif'>\r\n      {$w['Login']}</a></td>\r\n      <td class=ul>{$w['DSN']}</td>\r\n      <td class=ul>{$w['Homebase']}</td>\r\n      <td class=ul>{$_prd}</td>\r\n      </tr>";
    }
    echo "</table></p>";
}
Esempio n. 12
0
 function TampilkanHalaman()
 {
     // Hitung jumlah row
     $s_jml = "select count(0) as RW from " . $this->tables;
     $r_jml = _query($s_jml);
     $this->MaxRowCount = _result($r_jml, 0, 'RW');
     $this->maxrow = $this->maxrow == 0 ? 20 : $this->maxrow;
     $this->pagecount = ceil($this->MaxRowCount / $this->maxrow);
     $a = '';
     if ($this->page <= 0) {
         $this->page = 1;
     }
     if ($this->page > '$maxpages') {
         // Awal
         if ($this->page - 3 > 1) {
             $a .= $this->BuatHalaman1(1, $this->pages) . $this->pageseparator;
         }
         if ($this->page - 3 > 3) {
             $a .= "..." . $this->pageseparator;
         }
         // Tengah
         $a .= $this->BuatHalaman($this->page - 3 < 1 ? 1 : $this->page - 3, $this->page + 3 > $this->pagecount ? $this->pagecount : $this->page + 3);
         // Akhir
         if ($this->page + 3 < $this->pagecount - 1) {
             $a .= "..." . $this->pageseparator;
         }
         if ($this->page + 3 < $this->pagecount) {
             $a .= $this->BuatHalaman1($this->pagecount, $this->pages);
         }
     } else {
         $a .= $this->BuatHalaman(1, $this->pagecount);
     }
     $a = TRIM($a, $this->pageseparator);
     return $a;
 }
Esempio n. 13
0
function TampilkanDaftarProgramStudi()
{
    global $Cari;
    $Max = 50;
    $arrcr = explode(',', $Cari);
    $arrwhr = array();
    if (!empty($arrcr[0])) {
        $arrwhr[] = "(Nama like '%" . TRIM($arrcr[0]) . "%') ";
    }
    $whr = implode(' and ', $arrwhr);
    // Hitung jumlah baris
    $Jml = GetaField('perguruantinggi', "{$whr} and NA", 'N', "count(PerguruanTinggiID)");
    if ($Jml > $Max) {
        $_Jml = number_format($Jml);
        echo "<p><b>Catatan:</b> Jumlah program studi yang Anda cari mencapai: <b>{$_Jml}</b>, tetapi sistem membatasi\r\n      jumlah program studi yang ditampilkan dan hanya menampilkan: <b>{$Max}</b>.\r\n      Gunakan Nama program studi dengan lebih spesifik untuk membatasi\r\n      jumlah program studi yang ditampilkan.</p>\r\n\r\n      <p><b>Format Pencarian:</b> NamaProgramStudi</p>";
    }
    // Tampilkan
    $s = "select ProdiDiktiID, Nama\r\n    from prodidikti\r\n    where {$whr} and NA='N'\r\n    order by Nama limit {$Max}";
    $r = _query($s);
    $n = 0;
    echo "<p><table class=box cellspacing=1 cellpadding=4 width=100%>\r\n    <tr><th class=ttl>#</th>\r\n    <th class=ttl>Kode Prodi</th>\r\n    <th class=ttl>Nama</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        $n++;
        echo "<tr><td class=ul>{$n}</td>\r\n    <td class=ul><a href='javascript:kembalikan(\"{$w['ProdiDiktiID']}\", \"{$w['Nama']}\")'>{$w['ProdiDiktiID']}</a></td>\r\n    <td class=ul>{$w['Nama']}&nbsp;</td>\r\n    </tr>";
    }
    echo "</table></p>";
}
Esempio n. 14
0
function anti_injection($user, $pass, $ip)
{
    global $db;
    // We'll first get rid of any special characters using a simple regex statement.
    // After that, we'll get rid of any SQL command words using a string replacment.
    $banlist = array("'", "--", "select", "union", "insert", "update", "like", "delete", "distinct", "having", "truncate", "replace", "handler", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "desc", "1=1", "or", "#", "//", "' or '1'='1'", "'1'='1'");
    // ---------------------------------------------
    if (preg_match("/[a-zA-Z0-9]+/i", $user)) {
        $user = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($user)));
    } else {
        $user = NULL;
    }
    // ---------------------------------------------
    // Now to make sure the given password is an alphanumerical string
    // devoid of any special characters. strtolower() is being used
    // because unfortunately, str_ireplace() only works with PHP5.
    if (preg_match("/[a-zA-Z0-9]+/i", $pass)) {
        $pass = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($pass)));
    } else {
        $pass = NULL;
    }
    // ---------------------------------------------
    // Now to make an array so we can dump these variables into the SQL query.
    // If either user or pass is NULL (because of inclusion of illegal characters),
    // the whole script will stop dead in its tracks.
    $array = array('user' => $user, 'pass' => $pass);
    // ---------------------------------------------
    if (!IN_ARRAY(NULL, $array)) {
        return $array;
    }
}
Esempio n. 15
0
function ModSav()
{
    $md = $_REQUEST['md'];
    $MdlID = $_REQUEST['MdlID'];
    $MdlGrpID = $_REQUEST['MdlGrpID'];
    $Nama = sqling($_REQUEST['Nama']);
    $Script = $_REQUEST['Script'];
    $_levelid = TRIM($_REQUEST['LevelID'], '.');
    if (empty($_levelid)) {
        $LevelID = '';
    } else {
        $arrLevelID = explode('.', $_levelid);
        sort($arrLevelID);
        $LevelID = '.' . implode('.', $arrLevelID) . '.';
    }
    $Web = !empty($_REQUEST['Web']) ? $_REQUEST['Web'] : 'N';
    $CS = !empty($_REQUEST['CS']) ? $_REQUEST['CS'] : 'N';
    $Author = sqling($_REQUEST['Author']);
    $EmailAuthor = sqling($_REQUEST['EmailAuthor']);
    $Simbol = $_REQUEST['Simbol'];
    $Help = $_REQUEST['Help'];
    $NA = !empty($_REQUEST['NA']) ? $_REQUEST['NA'] : 'N';
    $Keterangan = sqling($_REQUEST['Keterangan']);
    // Simpan
    if ($md == 0) {
        $s = "update mdl set Nama='{$Nama}', MdlGrpID='{$MdlGrpID}', Script='{$Script}',\n      LevelID='{$LevelID}', Web='{$Web}', CS='{$CS}',\n      Author='{$Author}', EmailAuthor='{$EmailAuthor}', Simbol='{$Simbol}',\n      Help='{$Help}', NA='{$NA}', Keterangan='{$Keterangan}'\n      where MdlID='{$MdlID}'";
    } else {
        $s = "insert into mdl (MdlGrpID, Nama, Script, LevelID, Web, CS,\n      Author, EmailAuthor, Simbol, Help, NA, Keterangan)\n      values ('{$MdlGrpID}', '{$Nama}', '{$Script}', '{$LevelID}', '{$Web}', '{$CS}',\n      '{$Author}', '{$EmailAuthor}', '{$Simbol}', '{$Help}', '{$NA}', '{$Keterangan}')";
    }
    _query($s);
    DftrMdl();
}
 /**
  * 
  * @param string $string
  * @return boolean
  */
 public function validarVacio($string)
 {
     if (strip_tags(TRIM($string)) == "") {
         return false;
     } else {
         return true;
     }
 }
Esempio n. 17
0
function TampilkanDaftarPerguruanTinggi()
{
    global $Cari;
    $Max = 50;
    $arrcr = explode(',', $Cari);
    $arrcrmixed = array();
    $arrcrnama = array();
    $arrcrsingkatan = array();
    $arrwhrnamaangks = array();
    $arrwhrnama = array();
    $arrwhrkota = array();
    if (!empty($arrcr)) {
        if (count($arrcr) == 1) {
            $arrcrmixed = explode(' ', TRIM($arrcr[0]));
            RemoveBannedWords($arrcrmixed);
            foreach ($arrcrmixed as $cr) {
                if ($cr + 0 > 0) {
                    $arrwhrnamaangka[] = "Nama like ' " . TRIM($cr) . " ' ";
                } else {
                    $arrwhrnama[] = "Nama like '%" . TRIM($cr) . "%' ";
                    $arrcrsingkatan[] = "SingkatanNama like '%" . TRIM($cr) . "%' ";
                    $arrwhrkota[] = "Kota like '%" . TRIM($cr) . "%' ";
                }
            }
            $divider = "or";
        } else {
            $arrcrnama = explode(' ', TRIM($arrcr[0]));
            RemoveBannedWords($arrcrnama);
            foreach ($arrcrnama as $cr) {
                if ($cr + 0 > 0) {
                    $arrwhrnamaangka[] = "Nama like '% " . TRIM($cr) . " %' ";
                } else {
                    $arrwhrsingkatan[] = "SingkatanNama like '%" . TRIM($cr) . "%' ";
                    $arrwhrnama[] = "Nama like '%" . TRIM($cr) . "%' ";
                }
            }
            $arrwhrkota[] = "Kota like '%" . TRIM($arrcr[1]) . "%' ";
            $divider = "and";
        }
    }
    $whr = '(' . (!empty($arrwhrnama) ? implode(' or ', $arrwhrnama) : 1) . ') ' . (!empty($arrwhrsingkatan) ? $divider . ' (' . implode(' or ', $arrwhrsingkatan) : ' and (1') . ') ' . (!empty($arrwhrnamaangka) ? $divider . ' (' . implode(' or ', $arrwhrnamaangka) : ' and (1') . ') ' . (!empty($arrwhrkota) ? $divider . ' (' . implode(' or ', $arrwhrkota) : ' and (1') . ')';
    // Hitung jumlah baris
    $Jml = GetaField('perguruantinggi', "{$whr} and NA", 'N', "count(PerguruanTinggiID)");
    if ($Jml > $Max) {
        $_Jml = number_format($Jml);
        echo "<p><b>Catatan:</b> Jumlah perguruan tinggi yang Anda cari mencapai: <b>{$_Jml}</b>, tetapi sistem membatasi\r\n      jumlah perguruan tinggi yang ditampilkan dan hanya menampilkan: <b>{$Max}</b>.\r\n      Gunakan Nama perguruan tinggi dan Kota Sekolah dengan lebih spesifik untuk membatasi\r\n      jumlah perguruan tinggi yang ditampilkan.</p>\r\n\r\n      <p><b>Format Pencarian:</b> NamaPerguruanTinggi/Singkatan, KotaSekolah</p>";
    }
    // Tampilkan
    $s = "select PerguruanTinggiID, SingkatanNama, Nama, Kota\r\n    from perguruantinggi\r\n    where {$whr} and NA='N'\r\n    order by Nama limit {$Max}";
    $r = _query($s);
    $n = 0;
    echo "<p><table class=box cellspacing=1 cellpadding=4 align=center>\r\n    <form name='datapt' method=POST>\r\n\t<tr><th class=ttl>#</th>\r\n    <th class=ttl>Kode Sekolah</th>\r\n    <th class=ttl>Singkatan</th>\r\n    <th class=ttl>Nama</th>\r\n    <th class=ttl>Kota</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        $n++;
        echo "<tr><td class=ul>{$n}</td>\r\n    <td class=ul><a href='javascript:kembalikan(\"{$w['PerguruanTinggiID']}\", \"{$w['Nama']}\", \"{$w['Kota']}\")'>{$w['PerguruanTinggiID']}</a></td>\r\n    <td class=ul>{$w['SingkatanNama']}</td>\r\n    <td class=ul>{$w['Nama']}</td>\r\n    <td class=ul>{$w['Kota']}</td>\r\n    </tr>";
    }
    echo "\r\n\t<tr><td colspan=10 align=center><input type=button name='Tutup' value='Tutup' onClick=\"window.close()\"></td></tr>\r\n\t</form>\r\n  </table></p>";
}
Esempio n. 18
0
function CekHakAksesProdi($prd)
{
    $hak = TRIM($_SESSION['_ProdiID'], ',');
    $arrhak = explode(',', $hak);
    $ada = array_search($prd, $arrhak);
    if ($ada === false) {
        die(ErrorMsg('Tidak Berhak', "Anda tidak berhak mengakses modul ini"));
    }
}
Esempio n. 19
0
function GetArrayTable3($sql, $key, $label, $separator = ', ')
{
    // Digunakan untuk menerjemahkan array dalam string
    $r = _query($sql);
    $ret = '';
    while ($w = _fetch_array($r)) {
        $ret .= "'" . $w[$label] . "'" . $separator;
    }
    return TRIM($ret, $separator);
}
function BuatHeader($mxc, $jdwl, $prodi, $fak, $hal)
{
    $_lf = chr(13) . chr(10);
    $_prg = TRIM($jdwl['ProgramID'], '.');
    $_prg = explode('.', $_prg);
    $_prg = $_prg[0];
    $NamaTahun = GetaField('tahun', "TahunID='{$jdwl['TahunID']}' and ProgramID='{$_prg}' and ProdiID", $prodi['ProdiID'], 'Nama');
    $tgl = str_pad(date('d-m-Y'), 10);
    $jam = str_pad(date('H:i'), 10);
    $s = str_pad("Semester   : {$NamaTahun}", $mxc / 2) . str_pad("TGL   : {$tgl}", $mxc / 2, ' ', STR_PAD_LEFT) . $_lf . str_pad("Fak/Jur    : {$fak}/{$prodi['Nama']}", $mxc / 2) . str_pad("Jam   : {$jam}", $mxc / 2, ' ', STR_PAD_LEFT) . $_lf . str_pad("Kode M.K.  : {$jdwl['MKKode']} - {$jdwl['Nama']}", $mxc / 2) . str_pad("Form  : AKD610    ", $mxc / 2, ' ', STR_PAD_LEFT) . $_lf . str_pad("Dosen      : {$jdwl['DSN']}", $mxc / 2) . str_pad("Hal.  : " . str_pad($hal, 10), $mxc / 2, ' ', STR_PAD_LEFT) . $_lf;
    return $s;
}
function BuatNilai($w, $mhsw)
{
    $kd = "Select distinct mk.MKKode,mkpra.MKID as Kode \r\n    from mkpra \r\n    left outer join mk on mkpra.PraID = mk.MKID \r\n    where mkpra.MKID = '{$w['MKID']}'";
    $rkd = _query($kd);
    $retkd = '';
    while ($wkd = _fetch_array($rkd)) {
        $nl = GetaField2("krs", "Mhswid = '{$mhsw}' and MKKode", $wkd['MKKode'], 'order by BobotNilai DESC', 'GradeNilai');
        $nnl = !empty($nl) ? "(" . $nl . ")" : '';
        $retkd .= $wkd['MKKode'] . $nnl . ", ";
    }
    return TRIM($retkd, ", ");
}
Esempio n. 22
0
function JdwlTtp()
{
    $JadwalID = $_REQUEST['JadwalID'];
    $jdwl = GetFields('Jadwal', 'JadwalID', $JadwalID, '*');
    $jj = GetaField('jenisjadwal', 'JenisJadwalID', $jdwl['JenisJadwalID'], 'Nama');
    $hr = GetaField('hari', 'HariID', $jdwl['HariID'], 'Nama');
    // Ambil nama dosen
    $arrdosen = explode('.', TRIM($jdwl['DosenID'], '.'));
    $strdosen = implode(',', $arrdosen);
    $dosen = empty($strdosen) ? '' : GetArrayTable("select Nama from dosen where Login in ({$strdosen}) order by Nama", "Login", "Nama", ', ');
    $tgl = GetDateOption(date('Y-m-d'), 'Tgl');
    echo Konfirmasi('Tutup Kelas Kuliah', "<p>Benar Anda akan menutup kelas ini?</p>\r\n    <p><table class=box cellspacing=1 cellpadding=4>\r\n    <tr><td class=inp>Matakuliah</td><td class=ul>{$jdwl['MKKode']} - {$jdwl['Nama']} {$jdwl['NamaKelas']}</td></tr>\r\n    <tr><td class=inp>Jenis</td><td class=ul>{$jj}</td></tr>\r\n    <tr><td class=inp>Hari, Jam</td><td class=ul>{$hr}, {$jdwl['JamMulai']} ~ {$jdwl['JamSelesai']}</td></tr>\r\n    <tr><td class=inp>Dosen Pengampu</td><td class=ul>{$dosen}</td></tr>\r\n    </table></p>\r\n    <p>Jika ya, maka masukkan nomer surat penutupan dari Purek 1 di bawah ini:</p>\r\n    \r\n    <p><table class=box cellspacing=1 cellpadding=4>\r\n    <form action='?' method=POST>\r\n    <input type=hidden name='mnux' value='jadwal.tutup'>\r\n    <input type=hidden name='JadwalID' value='{$JadwalID}'>\r\n    <input type=hidden name='gos' value='JdwlTtp1'>\r\n    <tr><td class=inp>Nomer Surat</td><td class=ul><input type=text name='NoSurat' size=30 maxlength=50></td></tr>\r\n    <tr><td class=inp>Tanggal</td><td class=ul>{$tgl}</td></tr>\r\n    <tr><td class=inp>Alasan Penutupan</td><td class=ul><textarea name='Keterangan' cols=30 rows=5></textarea></td></tr>\r\n    <tr><td class=ul colspan=2><input type=button name='Batal' value='Batal Tutup' onClick=\"location='?mnux=jadwal.tutup'\">\r\n      <input type=reset name='Reset' value='Reset'>\r\n      <input type=submit name='Simpan' value='Tutup Kelas ini'></td></tr>\r\n    </form></table></p>\r\n    ");
}
function Cetak($t = 'UTS')
{
    global $_lf;
    $jdwl = GetFields('jadwal', 'JadwalID', $_REQUEST['jdwlid'], "*");
    $dsn = TRIM($jdwl['DosenID'], '.');
    $arrdsn = explode('.', $dsn);
    $strdsn = empty($arrdsn) ? "GaAdaNih" : implode(',', $arrdsn);
    $nmdsn = GetArrayTable("select concat(Nama, ', ', Gelar) as DSN from dosen where Login in ({$strdsn}) order by Nama", "Login", "DSN");
    // Buat file
    //$nmf = HOME_FOLDER  .  DS . "tmp/uts.$_REQUEST[jdwlid].dwoprn";
    $nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.dwoprn";
    $f = fopen($nmf, 'w');
    $maxkol = 80;
    $maxbrs = 40;
    fwrite($f, chr(27) . chr(77));
    // Buat header
    $div = str_pad('-', $maxkol, '-') . $_lf;
    $NamaTahun = NamaTahun($jdwl['TahunID']);
    $adagrade = $t == 'FINAL' ? 'Grade' : '';
    $adanilai = $t == 'FINAL' ? '       ' : "Nilai  ";
    $hdr = $_lf . $_lf . str_pad("*** Hasil Nilai {$t} ***", $maxkol, ' ', STR_PAD_BOTH) . $_lf . $_lf . "Semester       : " . $NamaTahun . $_lf . "Matakuliah     : " . str_pad($jdwl['MKKode'] . ' - ' . $jdwl['Nama'], 30) . $_lf . "Kelas          : " . $jdwl['NamaKelas'] . $_lf . "Dosen Pengampu : " . $nmdsn . $_lf . $div . "No. NPM             Nama Mahasiswa               {$adanilai}{$adagrade}" . $_lf . $div;
    fwrite($f, $hdr);
    // Tuliskan isinya
    $s = "select krs.*, LEFT(m.Nama, 30) as NamaMhsw\r\n    from krs krs\r\n      left outer join mhsw m on krs.MhswID=m.MhswID\r\n    where krs.JadwalID='{$jdwl['JadwalID']}'\r\n    order by krs.MhswID";
    $r = _query($s);
    $n = 0;
    $brs = 0;
    while ($w = _fetch_array($r)) {
        $n++;
        $brs++;
        $grd = $t == 'FINAL' ? $w['GradeNilai'] : '';
        fwrite($f, str_pad($n . '.', 4) . str_pad($w['MhswID'], 15) . ' ' . str_pad($w['NamaMhsw'], 30) . ' ' . str_pad($w[$t], 3, ' ', STR_PAD_LEFT) . '  ' . str_pad($grd, 3) . $_lf);
        if ($brs > $maxbrs) {
            $hal++;
            fwrite($f, $div);
            $brs = 1;
            fwrite($f, "Hal. " . $hal . $_lf);
            fwrite($f, chr(12));
            fwrite($f, $hdr);
        }
    }
    fwrite($f, $div);
    fwrite($f, str_pad(' ', 50) . "Paraf Dosen" . $_lf . $_lf . $_lf . $lf);
    fwrite($f, str_pad(' ', 50) . $nmdsn);
    // Tutup file
    fwrite($f, chr(12));
    fclose($f);
    // Cetak
    include_once "dwoprn.php";
    DownloadDWOPRN($nmf);
}
Esempio n. 24
0
 /**
  * Save method for editing a record in this table
  *
  * @param  string $mode:  edit if coming from edit, add if coming from add
  * @param  string $userId : The id of the user
  * @return NULL
  * @access public
  */
 public function saveRecord($userId, $mode = NULL)
 {
     $id = addslashes(TRIM($_POST['id']));
     $nodeId = addslashes(TRIM($_POST['nodeId']));
     //$userId = addslashes(TRIM($_POST['userId']));
     $note = addslashes(TRIM($_POST['note']));
     // if edit use update
     if ($mode == "edit") {
         $this->update("id", $id, array('nodeId' => $nodeId, 'userId' => $userId, 'note' => $note));
     }
     // if add use insert
     if ($mode == "add" || ($more = NULL)) {
         $this->insert(array('nodeId' => $nodeId, 'userId' => $userId, 'note' => $note));
     }
 }
Esempio n. 25
0
 function getTitle($cid)
 {
     if (TRIM($cid) === '') {
         return 'Home';
     } elseif ($cid == 0) {
         return 'Contact Us';
     } else {
         $result = mysql_query('SELECT name FROM categories WHERE status = 1 AND id = ' . $cid);
         if (mysql_num_rows($result) > 0) {
             $row = mysql_fetch_object($result);
             return $row->name;
         }
         return 'Home';
     }
 }
Esempio n. 26
0
function anti_injection($user, $pass, $ip)
{
    global $db;
    // We'll first get rid of any special characters using a simple regex statement.
    // After that, we'll get rid of any SQL command words using a string replacment.
    $banlist = array("'", "--", "select", "union", "insert", "update", "like", "delete", "distinct", "having", "truncate", "replace", "handler", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "desc", "1=1", "or", "#", "//", "' or '1'='1'", "'1'='1'");
    // ---------------------------------------------
    if (preg_match("/[a-zA-Z0-9]+/i", $user)) {
        $user = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($user)));
    } else {
        $user = NULL;
    }
    // ---------------------------------------------
    // Now to make sure the given password is an alphanumerical string
    // devoid of any special characters. strtolower() is being used
    // because unfortunately, str_ireplace() only works with PHP5.
    if (preg_match("/[a-zA-Z0-9]+/i", $pass)) {
        $pass = TRIM(STR_REPLACE($banlist, '', STRTOLOWER($pass)));
    } else {
        $pass = NULL;
    }
    // ---------------------------------------------
    // Now to make an array so we can dump these variables into the SQL query.
    // If either user or pass is NULL (because of inclusion of illegal characters),
    // the whole script will stop dead in its tracks.
    $array = array('user' => $user, 'pass' => $pass);
    // ---------------------------------------------
    if (IN_ARRAY(NULL, $array)) {
        /*
        		$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
        		$db->add_db(TB_IPBLOCK,array(
        			"ip"=>"".$ip."",
        			"post_date"=>"".time().""
        		));
        		$db->closedb ();
        ?>
        <BR><BR>
        <CENTER><A HREF="?name=index"><IMG SRC="images/dangerous.png" BORDER="0"></A><BR><BR>
        <FONT COLOR="#336600"><B><?=_ADMIN_IPBLOCK_MESSAGE_HACK;?> <?=WEB_EMAIL;?></B></FONT><BR><BR>
        <A HREF="?name=index"><B><?=_ADMIN_IPBLOCK_MESSAGE_HACK1;?></B></A>
        </CENTER>
        <?php echo "<meta http-equiv='refresh' content='10; url=?name=index'>" ; ?>
        <BR><BR>
        <?php */
    } else {
        return $array;
    }
}
Esempio n. 27
0
 public function checkservicio($attribute, $params)
 {
     if ($this->tipo == '00') {
         //si es un tipo  servicio
         $modelito = Maestrocompo::model()->findByPk(TRIM($this->codart));
         if (!$modelito === null) {
             $tipomaterial = $modelito->codtipo;
             //ADEMAS DEBE DE TENER EL TIPO DE DETALLE COMO TIPO SERVICIO '00'
             if (!($this->tipo == '00' and $tipomaterial == '00')) {
                 $this->adderror('tipo', 'Es un servicio pero el codigo no correpsonde');
             }
         } else {
             $this->adderror('codart', 'Lleno el tipo como servicio pero el codigo no corresponde');
         }
     }
 }
Esempio n. 28
0
function DftrDsn()
{
    if (!empty($_SESSION['tahun'])) {
        $_whr = array();
        if (!empty($_SESSION['prodi'])) {
            $_whr[] = "INSTR(j.ProdiID, '.{$_SESSION['prodi']}.')>0";
        }
        if (!empty($_SESSION['prid'])) {
            $_whr[] = "INSTR(j.ProgramID, '.{$_SESSION['prid']}.')>0";
        }
        $whr = empty($_whr) ? '' : 'and ' . implode(' and ', $_whr);
        $s = "select j.*, h.Nama as HR,\r\n\t  time_format(j.JamMulai, '%H:%i') as JM,\r\n\t  time_format(j.JamSelesai, '%H:%i') as JS\r\n\t  from jadwal j\r\n\t    left outer join hari h on j.HariID=h.HariID\r\n\t  where j.TahunID='{$_SESSION['tahun']}' {$whr}\r\n\t  order by j.ProgramID, j.ProdiID, j.MKKode";
        $r = _query($s);
        $nmr = 0;
        $_prodi = '';
        $hdr = "<tr><th class=ttl>#</th>\r\n\t  <th class=ttl>Kode</th>\r\n\t  <th class=ttl>Matakuliah</th>\r\n\t  <th class=ttl>Kelas</th>\r\n\t  <th class=ttl>SKS</th>\r\n\t  <th class=ttl>PROG</th>\r\n\t  <th class=ttl>RG</th>\r\n\t  <th class=ttl>Hari</th>\r\n\t  <th class=ttl>Jam</th>\r\n\t  <th class=ttl>Dosen</th>\r\n\t  <th class=ttl>per SKS</th>\r\n\t  <th class=ttl>per Kuliah</th>\r\n\t  <th class=ttl>Transport</th>\r\n\t  <th class=ttl>Lain2</th>\r\n\t  </tr>";
        echo "<p><table class=box cellspacing=1 cellpadding=4>";
        while ($w = _fetch_array($r)) {
            $nmr++;
            if ($_prodi != $w['ProdiID']) {
                // Ambil nama prodi
                $_prodi = $w['ProdiID'];
                if (!empty($w['ProdiID'])) {
                    $arrprodi = explode('.', TRIM($w['ProdiID'], '.'));
                    $strprodi = implode(',', $arrprodi);
                    $prodi = empty($strprodi) ? '' : GetArrayTable("select Nama from prodi where ProdiID in ({$strprodi}) order by ProdiID", "ProdiID", "Nama", ', ');
                } else {
                    $prodi = '';
                }
                $nmprodi = GetaField('prodi', 'ProdiID', $_prodi, 'Nama');
                echo "<tr><td class=ul colspan=15><b>{$prodi}</b></td></tr>";
                echo $hdr;
            }
            // Ambil data dosen
            if (!empty($w['DosenID'])) {
                $arrdosen = explode('.', TRIM($w['DosenID'], '.'));
                $strdosen = implode(',', $arrdosen);
                $dosen = empty($strdosen) ? '' : GetArrayTable("select concat('» ', Nama) as NM from dosen where Login in ({$strdosen}) order by Nama", "Login", "NM", '<br /> ');
            } else {
                $dosen = '';
            }
            $c = "class=ul";
            echo "<tr><td class=inp>{$nmr}</td>\r\n\t    <td {$c} nowrap>{$w['MKKode']}</td>\r\n\t\t<td {$c}>{$w['Nama']}</td>\r\n\t\t<td {$c}>{$w['NamaKelas']}&nbsp;</td>\r\n\t\t<td {$c}>{$w['SKS']} ({$w['SKSAsli']})</td>\t\t\r\n\t\t<td {$c}>{$w['ProgramID']}</td>\r\n\t\t<td {$c}>{$w['RuangID']}</td>\r\n\t\t<td {$c}>{$w['HR']}</td>\r\n\t\t<td {$c}>{$w['JM']}~{$w['JS']}</td>\r\n\t\t<td {$c}>{$dosen}&nbsp;</td>\r\n\t\t<td {$c}>&nbsp;</td>\r\n\t\t<td {$c}>&nbsp;</td>\r\n\t\t<td {$c}>&nbsp;</td>\r\n\t\t<td {$c}>&nbsp;</td>\r\n\t\t</tr>";
        }
        echo "</table></p>";
    }
}
 function add_datatype($common, $db_object, $form_array, $default, $error_msg)
 {
     //	extract($form_array);
     while (list($kk, $vv) = @each($form_array)) {
         ${$kk} = $vv;
         if (ereg("fLabelvalue_", $kk)) {
             $id = split("fLabelvalue_", $kk);
             $id = $id[1];
             $idset[$id] = $vv;
         }
     }
     //print_r($form_array);
     //print_r($idset);
     while (list($kk, $vv) = @each($idset)) {
         $name = "name_" . $kk;
         $langset .= "{$name}='{$vv}',";
     }
     $user_table = $common->prefix_table("user_table");
     $name_fields = $common->prefix_table("name_fields");
     $name = "name_" . $default;
     $fieldname = TRIM($fLabel);
     $chkarr = preg_split("/ /", $fieldname, -1, PREG_SPLIT_NO_EMPTY);
     $ch_cnt = count($chkarr);
     if ($ch_cnt > 1) {
         echo "Enter Without Space";
         //	echo "<script>window.location.replace('add_new_labels.php')</script>";
     } else {
         $selqry = "desc {$name_fields}";
         $fieldarray = $db_object->get_single_column($selqry);
         $selqry = "desc {$user_table}";
         $userfields = $db_object->get_single_column($selqry);
         if (@in_array($fieldname, $userfields) || @in_array($fieldname, $fieldarray)) {
             echo "The Field Already Exists";
         } else {
             $insqry = "insert into {$name_fields} set field_name='{$fieldname}',{$langset} status='NO'";
             $db_object->insert($insqry);
             echo "ins={$insqry}<br>";
             $alterqry = "alter table {$user_table} add column {$fLabel} {$fDatatype}";
             $db_object->insert($alterqry);
             echo "alt={$alterqry}<br>";
             echo "<script>window.location.replace('add_lables.php')</script>";
         }
     }
 }
Esempio n. 30
0
function TampilkanMhswBebas($jdwl)
{
    $ProdiID = TRIM($jdwl['ProdiID'], '.');
    $s = "select k.*,\r\n      m.Nama as NamaMhsw, m.TahunID as Angkatan\r\n    from khs k\r\n      left outer join mhsw m on m.MhswID=k.MhswID\r\n    where k.TahunID='{$jdwl['TahunID']}'\r\n      and k.ProdiID='{$ProdiID}'\r\n    order by k.MhswID";
    $r = _query($s);
    $n = 0;
    echo "<p>Jumlah: " . _num_rows($r) . "</p>";
    KembalikanNilai();
    $btn = "<input type=button name='Simpan' value='Daftarkan' onClick=\"DaftarkanMhswBebas()\">";
    echo "<form action='mhsw.klinik.bebas.pra.php' name='data' method=POST>\r\n    <input type=hidden name='JadwalID' value='{$jdwl['JadwalID']}'>";
    echo "<input type=text name='Mhsw2' value='' size=100>";
    echo "<p><table class=box>\r\n    <tr><th class=ttl>#</th>\r\n    <th class=ttl>{$btn}</th>\r\n    <th class=ttl>N.P.M</th>\r\n    <th class=ttl>Nama Mhsw</th>\r\n    <th class=ttl>Angkatan</th>\r\n    </tr>";
    while ($w = _fetch_array($r)) {
        $n++;
        echo "<tr>\r\n      <td class=inp>{$n}</td>\r\n      <td class=ul><input type=checkbox name='MhswID_{$w['MhswID']}' value='{$w['MhswID']}' onChange='javascript:KomaMhsw(data.MhswID_{$w['MhswID']})'></td>\r\n      <td class=ul>{$w['MhswID']}</td>\r\n      <td class=ul>{$w['NamaMhsw']}</td>\r\n      <td class=ul>{$w['Angkatan']}</td>\r\n    </tr>";
    }
    echo "<tr><td class=ul>&nbsp;</td>\r\n    <td class=ul>{$btn}</td>\r\n    <td class=ul colspan=2>&nbsp;</td></tr>";
    echo "</table></p>";
    echo "</form>";
}