本文整理汇总了PHP中TRIM函数的典型用法代码示例。如果您正苦于以下问题:PHP TRIM函数的具体用法?PHP TRIM怎么用?PHP TRIM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRIM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TampilkanJadwalDosen
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']} </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>";
}
示例2: saveStories
/**
* 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));
}
}
示例3: ProsesBeneran
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>";
}
示例4: inverseHex
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;
}
示例5: InsertarPeritajeNuevo
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;
}
}
示例6: cargarCuentas
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;
}
示例7: trim
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, $数据字段, $操作记录编号);
}
}
示例8: DetailBIPOT
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);
}
示例9: cargarCuentas
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;
}
示例10: TampilkanDaftarSekolah
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>";
}
示例11: TampilkanDaftarDosen
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>";
}
示例12: TampilkanHalaman
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;
}
示例13: TampilkanDaftarProgramStudi
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']} </td>\r\n </tr>";
}
echo "</table></p>";
}
示例14: anti_injection
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;
}
}
示例15: ModSav
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();
}