session_start(); include "class_db.php"; /***************************************************************************** * * * DB Initialising * ****************************************************************************/ class DB_Example extends DB_Sql { var $Host = "localhost"; var $Database = "javanesia_deerfos"; //var $User = "root"; //var $Password = "root"; var $User = "deerfosindonesia"; var $Password = "d33rf05"; } $db=new DB_Example; $db1=new DB_Example; /* Date Setup */ $bulan = array('Januari', 'Pebruari', 'Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','Nopember','Desember'); $periode = array('01'=>'Januari','02'=>'Pebruari','03'=>'Maret','04'=>'April','05'=>'Mei','06'=>'Juni','07'=>'Juli','08'=>'Agustus','09'=>'September','10'=>'Oktober','11'=>'Nopember','12'=>'Desember'); /***************************************************************************** * * * Text truncate * * Parameter $text, $length=char widht * ****************************************************************************/ function get_text($text, $length) { $text_brief = substr($text, 0, $length); $text_brief_last_word_pos = strrpos($text_brief, " "); $text_brief = substr($text_brief, 0, $text_brief_last_word_pos); return $text_brief . " ..."; } /***************************************************************************** * * * Text secure * * Parameter $text * ****************************************************************************/ function sectext($text) { $text = preg_replace("/(\"; } /***************************************************************************** * * * Date format Indonesia * * Parameter $src=date query record * ****************************************************************************/ function fdate($src) { return preg_replace("/([0-9]+)-([0-9]+)-([0-9]+)/ie", "'\\3/'.str_pad('\\2', 2, '0', STR_PAD_LEFT).'/'.str_pad('\\1', 2, '0', STR_PAD_LEFT)", $src); } /***************************************************************************** * * * Navigation Back * * * ****************************************************************************/ function backof() { ?> exit; } /***************************************************************************** * * * Alert Windows * * Parameter $sscript=messages * ****************************************************************************/ function boxalert($sscript) { if ($sscript!='') { echo (""); } } /***************************************************************************** * combo date * * Parameter * ****************************************************************************/ function comboTgl() { for ($i=1;$i<32;$i++) { for ($j=0;$j<(2-strlen($i));$j++ ) $i="0".$i; print "\n"; } } function comboBln() { global $bulan; for ($i=0;$i<12;$i++) { $j+=1; for ($k=0;$k<(2-strlen($j));$k++ ) $j="0".$j; print "\n"; } } function comboThn($mulai,$sampai) { for ($i=$mulai;$i<$sampai+1;$i++) { $j+=1; print "\n"; } } /***************************************************************************** * ID en-de code * * Parameter $str * ****************************************************************************/ function encID($str) { return base64_encode($str); } function decID($str) { return base64_decode($str); } /***************************************************************************** * GENERATE PASSWORD * * Parameter * ****************************************************************************/ function generate_password($length = 6) { $allowable_characters = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefhjkmnpqrstuvwxyz23456789"; $ps_len = strlen($allowable_characters); mt_srand((double)microtime()*1000000); $pass = ""; for($i = 0; $i < $length; $i++) { $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } // End for return $pass; } function link2($param1){ return $link = "?page=".$param1; } function goURL($url) { ?> } function incmod($param){ global $db,$db1; $path = "modul/"; $modname = "mod_".$param.".php"; if(file_exists($path.$modname)) return include $path.$modname; else return 1; } function con($fcontent){ $fcontent = str_replace("../image","image",$fcontent); return stripslashes($fcontent); } function pname($ftitle){ $fcontent = str_replace(" ","+",$ftitle); return ($fcontent); } function pname2($ftitle){ $fcontent = str_replace("_"," ",$ftitle); return ($fcontent); } function titlepage($page){ if($page!='') $p1 = eregi_replace("_"," ",$page); else $p1 = ""; return ucwords($p1); } function titlepage2($vIP){ global $db1; $sql="select fname from links where ftitle='$vIP'"; $db1->query($sql); if($db1->next_record()) return strtoupper($db1->f("fname")); else return "Selamat Datang di Deerfos Indonesia"; } function tlrecord($vIP){ global $db1; $sql="select ftitle from m_galeri where fid='$vIP'"; $db1->query($sql); if($db1->next_record()) return strtoupper($db1->f("ftitle")); } function titlenav($vIP){ global $db1; $sql="select ftitle from m_galeri where fid='$vIP'"; $db1->query($sql); if($db1->next_record()) return strtoupper($db1->f("ftitle")); } function jumit($vIP){ global $db1; $sql="select count(*) as jumlah from tb_produk where fip='$vIP'"; $db1->query($sql); if($db1->next_record()) return $db1->f("jumlah"); } ?>