"Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nop", "Des" ); function chtime($diff_time){ $this->_diff_time = $diff_time; } function show($strtime, $param = ""){ $param = explode("|", $param); $site_tgl = date("d", $strtime + $this->_diff_time); $site_bln = date("m", $strtime + $this->_diff_time); $site_thn = date("Y", $strtime + $this->_diff_time); $site_jam = date("H", $strtime + $this->_diff_time); $site_mnt = date("i", $strtime + $this->_diff_time); $site_dtk = date("s", $strtime + $this->_diff_time); if (in_array("time", $param)){ return "$site_jam:$site_mnt:$site_dtk"; } else { $site_prefix = "$site_tgl-$site_bln-$site_thn"; if (in_array("alpha", $param)) $site_prefix = "$site_tgl ".$this->_bulan[(int) $site_bln]." $site_thn"; if (in_array("today", $param)){ $i = mktime(0, 0, 0, $site_bln, $site_tgl, $site_thn); $j = mktime(0, 0, 0, date("m", time() + $this->_diff_time), date("d", time() + $this->_diff_time), date("Y", time() + $this->_diff_time)); if ($i == $j) $site_prefix = "hari ini"; if ($i == ($j - (24*60*60))) $site_prefix = "kemarin"; } if (in_array("alpha", $param)) return "$site_prefix | $site_jam:$site_mnt"; return "$site_prefix | $site_jam:$site_mnt"; } } } $servtime = @new chtime($diff_time); function linker($str){ global $links; foreach ($links as $link){ $ch = explode("=>", $link); $ch[0] = trim($ch[0]); $ch[1] = trim($ch[1]); $ch[2] = trim($ch[2]); if ($ch[0] === 'string'){ $str = str_replace($ch[1], ''.$ch[1].'', $str); } else if ($ch[0] == 'regex'){ $str = preg_replace('/'.$ch[1].'/i', '\\1', $str); } } return $str; } function my_buddy($str){ global $buddies; foreach ($buddies as $buddy){ $ch = explode("=>", $buddy); $ch[0] = trim($ch[0]); $ch[1] = trim($ch[1]); $ch[2] = trim($ch[2]); if (strtolower($str) === strtolower($ch[0])){ $str = str_replace($str, "$str $ch[1]", $str); return $str; } } return "$str"; } function emo_trans($str, $safe = false){ global $emo_dir; $emo = array( array(":-*", ":1.gif:", "\":-*\""), array(":*", ":1.gif:", "\":*\""), array("=))", ":2.gif:", "\"=))\""), array(":))", ":3.gif:", "\":))\""), array(":-)", ":4.gif:", "\":-)\""), array(":)", ":4.gif:", "\":)\""), array(":((", ":5.gif:", "\":((\""), array(";-)", ":6.gif:", "\";-)\""), array(";))", ":13.gif:", "\";))\""), array(":-P", ":7.gif:", "\":-P\""), array(":-p", ":7.gif:", "\":-p\""), array(":P", ":7.gif:", "\":P\""), array(":p", ":7.gif:", "\":p\""), array(":b", ":7.gif:", "\":b\""), array(":-(", ":8.gif:", "\":-(\""), array(":(", ":8.gif:", "\":(\""), array(":-D", ":9.gif:", "\":-D\""), array(":D", ":9.gif:", "\":D\""), array(":-d", ":9.gif:", "\":-d\""), array(":d", ":9.gif:", "\":d\""), array(":-O", ":10.gif:", "\":-O\""), array(":O", ":10.gif:", "\":O\""), array(":-o", ":10.gif:", "\":-o\""), array(":o", ":10.gif:", "\":o\""), array(":-/", ":11.gif:", "\":-/\""), array(":-?", ":12.gif:", "\":-?\""), array(";)", ":6.gif:", "\";)\""), array("X-(", ":14.gif:", "\"X-(\""), array("X(", ":14.gif:", "\"X(\""), array("x-(", ":14.gif:", "\"x-(\""), array("x(", ":14.gif:", "\"x(\""), array("Z-)", ":15.gif:", "\"Z-)\""), array("Z)", ":15.gif:", "\"Z)\""), array("z-)", ":15.gif:", "\"z-)\""), array("z)", ":15.gif:", "\"z)\"") ); for ($i=0; $i_kode = substr(md5(substr(microtime().$this->_key, 3, 6)), 12, 1); } function kode_val($key){ if (empty($key)) return false; return strtoupper(substr(md5($key.$this->_key), 4, 10)); } function kode_show(){ return $this->_kode; } } class sherlock{ var $_uagent; function sherlock($ua){ $this->_uagent = strip_tags($ua); } function headinfo(){ global $separator2; if ($_SERVER['HTTP_MSISDN']){ $msdn = explode(" ", $_SERVER['HTTP_MSISDN']); } else if ($_SERVER['HTTP_X_MSP_MSISDN']){ $msdn = explode(" ", $_SERVER['HTTP_X_MSP_MSISDN']); } else if ($_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN']){ $msdn = explode(" ", $_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN']); } else if ($_SERVER['HTTP_MIN']){ $msdn = explode(" ", $_SERVER['HTTP_MIN']); } else { $msdn = explode(" ", $_SERVER['HTTP_X_UP_CALLING_LINE_ID']); } if (preg_match("/^([0-9])+$/", $msdn[0])){ $_iplocal = ($msdn[1]) ? $msdn[1] : ""; $_nophone = ($msdn[0]) ? $msdn[0] : ""; } else { $_iplocal = ($msdn[0]) ? $msdn[0] : ""; $_nophone = ($msdn[1]) ? $msdn[1] : ""; } $_proxy = ""; $_proxyhost = ""; $_ip = $_SERVER['HTTP_CLIENT_IP']; $_iphost = @gethostbyaddr($_SERVER['HTTP_CLIENT_IP']); $_via = ($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] : ""; $_opmin = (strlen($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) > strlen($_SERVER['HTTP_X_OPERAMINI_PHONE'])) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : $_SERVER['HTTP_X_OPERAMINI_PHONE']; if ($_SERVER['HTTP_X_FORWARDED_FOR']){ $_proxy = $_SERVER['REMOTE_ADDR']; $_proxyhost = @gethostbyaddr($_SERVER['REMOTE_ADDR']); $_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; $_iphost = @gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']); } if (!$_ip){ $_ip = $_SERVER['REMOTE_ADDR']; $_iphost = @gethostbyaddr($_SERVER['REMOTE_ADDR']); } return strip_tags("$_iplocal$separator2$_nophone$separator2$_via$separator2$_proxy$separator2$_proxyhost$separator2$_ip$separator2$_iphost$separator2$_opmin"); } function cellInfo($userIP){ $celDef = array( // Mobile '/\b202\.152\.240\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[5-9][0-9])\b/' => 'ProXL', '/\b203\.78\.(12[0-7]|11[2-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Axis', '/\b202\.93\.(3[6-7])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Indosat', '/\b202\.59\.174\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Three', '/\b202\.70\.(6[0-3]|5[0-9]|4[8-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Smart', '/\b202\.3\.(22[0-3]|21[0-9]|20[89])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Telkomsel', '/\b221\.132\.(25[0-5]|2[0-4][0-9]|19[2-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Telkomsel', '/\b202\.152\.(9[0-5]|[7-8][0-9]|6[4-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'brunei_Simpur', '/\b202\.160\.(4[0-7]|3[2-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Brunet', '/\b203\.92\.(15[0-9]|1[3-4][0-9]|12[8-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'DiGi', '/\b200\.142\.20\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Vivo', '/\b200\.142\.128\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Vivo', '/\b189\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'TIM Brasil', // Home/Office '/\b124\.195\.56\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Indosat M2', '/\b202\.123\.239\.(19[01]|1[3-8][0-9]|12[89])\b/' => 'Tabina 3GNet', '/\b125\.(16[0-3])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Telkom Speedy', '/\b222\.124\.(12[0-7]|1[0-1][0-9]|[7-9][0-9]|6[4-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Telkom Speedy', '/\b222\.124\.209\.(3[0-1]|[1-2][0-9]|[0-9])\b/' => 'Telkomnet', '/\b203\.130\.(25[0-5]|2[0-4][0-9]|19[2-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Telkomnet', '/\b202\.65\.(12[0-7]|11[2-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\b/' => 'Citranet', ); foreach ($celDef as $celPat => $celOp){ if (preg_match($celPat, $userIP)) return $celOp; } return false; } function browser(){ $uarep = array( '/^opera mini/si' => 'Oplet', '/^lenovo/si' => 'Lenovo', '/^tianyu/si' => 'K-Touch', '/mowser/si' => 'Mowser', '/^sie/si' => 'Siemens', '/^mot/si' => 'Motorola', '/symbianos/si' => 'Symbian', '/^(nokia)(.*)\-[0-9]+/si' => '\\1 \\2', '/^sonyericsson/si' => 'SE', '/netfront/si' => 'NetFront' ); $uadef = array( '/(sonyericsson)[ ]{0,1}([0-9a-z\+\-\.]+).*/si' => array( '/(netfront)\/([0-9a-z\+\-\.]+).*/si|^| /(SEMC)/si|^| /(opera)[ |\/]{0,1}([0-9a-z\+\-\.]+).*/si', 'se' ), '/(Googlebot)[\-a-z]*\/([0-9a-z\+\-\.]+).*/i' => array('', 'robot'), '/(nokia)[ ]{0,1}([0-9a-z\+\-\.]+).*/si' => array( '/(safari)\/([0-9a-z\+\-\.]+).*/si|^| /(opera)[ |\/]{0,1}([0-9a-z\+\-\.]+).*/si', 'nokiem' ), '/(mot)\-([0-9a-z\+\-\. ]+).*/si' => array( '/(opera)[ |\/]{0,1}([0-9a-z\+\-\.]+).*/si', 'moto' ), '/(sie)\-([0-9a-z\+\-\.]+).*/si' => array('', 'siemens'), '/(o2)[ ]{0,1}([0-9a-z\+\-\. ]+).*/si' => array('', 'o2'), '/(lenovo)\-([0-9a-z\+\-\.]+).*/si' => array('', 'lenovo'), '/(tianyu)[\-| |\/|ktouch]*([0-9a-z\+\-\.]+).*/si' => array('', 'ktouch'), '/(opera mini)\/([0-9a-z\+\-\.]+).*/si' => array('', 'opmin'), '/mozilla.*gecko\/[0-9]+.*(k\-meleon)\/([0-9a-z\+\-\.]+)$/si' => array('', 'k-meleon'), '/mozilla.*gecko\/[0-9]+.*(minefield)\/([0-9a-z\+\-\.]+)$/si' => array('', 'minefield'), '/mozilla.*gecko\/[0-9]+.*(firefox)\/([0-9a-z\+\-\.]+)$/si' => array('', 'firefox'), '/mozilla.*gecko\/[0-9]+.*(seamonkey)\/([0-9a-z\+\-\.]+)$/si' => array('', 'seamonkey'), '/mozilla.*(konqueror)\/([0-9a-z\+\-\.]+).*/si' => array('', 'konqueror'), '/mozilla.*gecko.*(safari)\/([0-9a-z\+\-\.]+).*/si' => array('/(symbianOS)\/([0-9a-z\+\-\.]+)/si|^|/(Mac)/si', 'safari'), '/mozilla.*(netfront)\/([0-9a-z\+\-\.]+)$/si' => array('/(symbian)/si', 'nf'), '/(opera)[ |\/]{0,1}([0-9a-z\+\-\.]+).*/si' => array('/(symbian)/si', 'opera'), '/mozilla.*(msie) ([0-9a-z\+\-\.]+).*/si' => array('/(google)/si|^|/(mowser)/si', 'msie'), '/(mozilla)[\/]{0,1}([0-9a-z\+\-\.]*).*/si' => array('/(phonifier)/si|^|/(Linux)/si','mozilla'), //'/([0-9a-z\+\-\.]*)[\/]{0,1}([0-9a-z\+\-\.]*).*/si' => array('','unknown') ); foreach ($uadef as $pat => $more){ $more2 = ''; $detail = ''; if (preg_match($pat, $this->_uagent, $tmp)){ if ($more[0] !== ''){ $more2 = explode('|^|', $more[0]); foreach ($more2 as $more3){ if (preg_match($more3, $this->_uagent, $tmp2)){ $detail = ' ['.$tmp2[1].($tmp2[2] ? ' '.$tmp2[2] : '').']'; break; } } } $browser = $tmp[1].($tmp[2] ? ' '. $tmp[2] : '').($detail ? $detail : ''); foreach ($uarep as $src => $rep) $browser = preg_replace($src, $rep, $browser); break; } } return (!$browser) ? 'Fake Header' : $browser; } } class validasi{ var $_param; var $_tpl = array( "isi" => "%s harus diisi", "min" => "%s harus > %s", "max" => "%s harus < %s", "all_str" => "%s harus dalam range [a-zA-Z0-9._-] dan spasi", "all_nospace" => "%s harus dalam range [a-zA-Z0-9._-]", "email" => "%s tidak valid", "site" => "%s tidak valid", "security" => "%s tidak valid", "is_admin" => "Login failed
%s salah", "cocok" => "Field %s != %s", "blist" => "%s masuk blacklist", "is_admin" => "%s salah" ); var $_error; var $_error_str = ""; function validasi($param){ foreach ($param as $key => $val){ $this->_param[$key] = $val; } } function hasil(){ global $separator; foreach ($this->_param as $field => $rules){ $rules = explode("|", $rules); foreach ($rules as $rule){ if (preg_match("/(.*?)\[(.*?)\]/i", $rule, $log)){ $rule = $log[1]; $param = $log[2]; } if (!$this->$rule(str_replace($separator, "", $_POST[$field]), $param)){ $field = strtoupper(substr($field, 0, 1)).substr($field, 1, strlen($field) -1); $this->_error[] = sprintf($this->_tpl[$rule], $field, $param); break; } } } if (count($this->_error) > 0){ foreach ($this->_error as $str){ $this->_error_str .= "

$str

\r\n\t"; } return false; } return true; } function isi($field){ global $separator, $separator2; $field = str_replace($separator, "", $field); $field = str_replace($separator2, "", $field); return (trim($field) == "") ? false : true; } function min($field, $param){ if (empty($param)) return false; return (strlen($field) < ((int) $param)) ? false : true; } function max($field, $param){ if (empty($param)) return false; return (strlen($field) > ((int) $param)) ? false : true; } function all_str($field){ return (!preg_match("/^([a-zA-Z0-9._\-\040])+$/i", $field)) ? false : true; } function all_nospace($field){ return (!preg_match("/^([a-zA-Z0-9._\-])+$/i", $field)) ? false : true; } function site($field){ if (trim($field) == "") return true; if (preg_match("/http(s)?:\/\//i", $field)) return false; return (!preg_match("/^(([0-9a-z\-])+\.([0-9a-z\-])+)+(.*)$/i", $field)) ? false : true; } function email($field){ if (trim($field) == "") return true; return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $field)) ? false : true; } function blist($field, $param){ global $forbidden_name, $forbidden_mail, $forbidden_site; if (empty($param)) return false; if ($param == "name"){ foreach ($forbidden_name as $shit) if (preg_match("/$shit/i", strtolower($field))) return false; return true; } if ($param == "mail"){ foreach ($forbidden_mail as $shit) if (preg_match("/$shit/i", strtolower($field))) return false; return true; } if ($param == "site"){ foreach ($forbidden_site as $shit) if (preg_match("/$shit/i", strtolower($field))) return false; return true; } } function cocok($field, $param){ if (empty($field) && empty($_POST[$param])) return false; return ($field !== $_POST[$param]) ? false : true; } function security($field, $param){ $secode = @new kode_gen(); if (empty($param)) return false; return ($secode->kode_val($field) === $_POST[$param]) ? true : false; } function is_admin($field){ global $master_pass; return (md5($field) === $master_pass) ? true : false; } } class halaman{ var $total = 0; var $tampil = 0; var $total_hal = 0; var $nav = ""; function halaman($total, $tampil, $hal){ $this->total = $total; $this->tampil = $tampil; $this->total_hal = ceil($this->total/$this->tampil); $this->hal = (!isset($hal) || $hal > $this->total_hal || $hal < 1) ? 1 : $hal; } function start_offset(){ return ($this->tampil * $this->hal) - $this->tampil; } function stop_offset(){ if ($this->tampil * $this->hal > $this->total) return $this->total; return $this->tampil * $this->hal; } function navigasi(){ global $idx, $tampil_roll; $is_p = false; $url = explode("&", $_SERVER['QUERY_STRING']); $url_form = $url; for ($i=0; $i\r\n\t"; } } $this->nav .= "
\r\n\t"; $view = 0; if ($this->hal > ceil($tampil_roll/2) || $this->hal > $tampil_roll){ if (($this->total_hal - $this->hal) <= ((int) ($tampil_roll/2))){ $start = $this->hal - ((2 * ((int) ($tampil_roll/2))) - ($this->total_hal - $this->hal)); } else { $start = $this->hal - (int) ($tampil_roll/2); } if ($start < 1) $start = 1; } else { $start = 1; } for ($i=$start; $i<=$this->total_hal; $i++){ if ($view == $tampil_roll) break; if ($i == $this->hal){ $this->nav .= "$i "; } else { $this->nav .= "$i "; } $view++; } $this->nav .= "
\r\n\t"; $this->nav .= ($this->total_hal > 1 && $this->hal > 1) ? "hal - 1)."\" title=\"Previous\">[prev] " : "[prev] "; $this->nav .= " [$this->hal/$this->total_hal/$this->total] "; $this->nav .= ($this->total_hal > 1 && $this->hal < $this->total_hal) ? "hal + 1)."\" title=\"Next\">[Next]" : "[Next]"; $this->nav .= "
\r\n\t
\r\n\t" ."$inpt" ."
\r\n\t" ."\r\n\t" ."

\r\n\t"; return ($this->total_hal > 1) ? $this->nav : ""; } } class who_online{ var $_info = array(); var $_data; var $_sid; function who_online($pos, $pos_url, $ol_dir = "./"){ global $ol_file, $separator; $this->_sid = $_SESSION['SID']; $this->_info = (isset($_SESSION['GIZMO_GIA_GIAS'])) ? explode($separator, base64_decode($_SESSION['GIZMO_GIA_GIAS'])) : false; $this->_data = @file($ol_dir.$ol_file); $this->user_delete(); $sherlock = new sherlock($_SERVER['HTTP_USER_AGENT']); $this->_data[] = trim(time().$separator.$this->_sid.$separator.trim($this->_info[1]).$separator.$pos.$separator.$pos_url.$separator.$sherlock->headinfo().$separator.$sherlock->_uagent); $fp = @fopen($ol_dir.$ol_file, 'w'); foreach($this->_data as $record) @fwrite($fp, trim($record)."\n"); @fclose($fp); } function user_delete(){ global $ol_timeout, $separator; $sherlock = new sherlock($_SERVER['HTTP_USER_AGENT']); $idx = 0; foreach ($this->_data as $record){ $field = explode($separator, $record); if (($field[1] == $this->_sid) || $field[0] < (time() - $ol_timeout) || (trim($field[2]) === $this->_info[1]) || (trim($field[5]).trim($field[6]) == trim($sherlock->headinfo()).trim($sherlock->_uagent)) || (trim($field[6]) == trim($sherlock->_uagent))){ unset($this->_data[$idx]); } $idx++; } } function user_number(){ return count($this->_data); } } ?>
Snack's 1967