$_SERVER['HTTP_HOST'] = str_replace('www.','',$_SERVER['HTTP_HOST']);
//if (strtolower($_SERVER['HTTP_HOST']) != "mp4.az")die("
Coded by Savik");
function count_view($count) {
$count = str_replace('.','',$count);
$units = array( null, 'K', 'M', 'B', 'T', 'Q', 'Qi', 'S', 'SP');
$power = $count > 0 ? floor(log($count, 1000)) : 0;
return round(number_format($count / pow(1000, $power), 2, '.', ','),2).$units[$power];
}
function deloldfile($myfile, $del_time) {
$dir = opendir($myfile);
while($file = readdir($dir)){
if(is_file($myfile."/".$file) && $file!=".htaccess" && filemtime($myfile."/".$file) < (time() - $del_time)){
unlink($myfile."/".$file);
}
}
closedir($dir);
}
function anti_ddos($a = '0') {
global $_SERVER;
deloldfile("anti_ddos", "600");
return crative_ip_dat($a);
}
function crative_ip_dat($save) {
global $_SERVER;
if (file_exists( 'anti_ddos/block_ip_' . $_SERVER['REMOTE_ADDR'] )) {
$datfile = file( 'anti_ddos/block_ip_' . $_SERVER['REMOTE_ADDR'] );
$datfile = trim( $datfile[0] );
if (10 <= $datfile) {
return 'block';
}
}
if ($save == '1') {
$file = @fopen( 'anti_ddos/block_ip_' . $_SERVER['REMOTE_ADDR'], 'w' );
@fwrite( $file, $datfile + 1 );
@fclose( $file );
}
}
function filtre($message){
global $set;
$netice = false;
$kelimeler = explode("-", $set["filtir"]);
foreach($kelimeler as $kelime ){
if(eregi($kelime,strtolower($message))){
$message = str_replace($kelime, false, $message);
$netice = true;
}
}
return array($message,$netice);
}
function curlGet($URL) {
$ch = curl_init();
$timeout = 3;
curl_setopt( $ch , CURLOPT_URL , $URL );
curl_setopt( $ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $ch , CURLOPT_CONNECTTIMEOUT , $timeout );
/* if you want to force to ipv6, uncomment the following line */
//curl_setopt( $ch , CURLOPT_IPRESOLVE , 'CURLOPT_IPRESOLVE_V6');
$tmp = curl_exec( $ch );
curl_close( $ch );
return $tmp;
}
/*
* function to use cUrl to get the headers of the file
*/
function get_location($url) {
$my_ch = curl_init();
curl_setopt($my_ch, CURLOPT_URL,$url);
curl_setopt($my_ch, CURLOPT_HEADER, true);
curl_setopt($my_ch, CURLOPT_NOBODY, true);
curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($my_ch, CURLOPT_TIMEOUT,10);
$r = curl_exec($my_ch);
foreach(explode("\n", $r) as $header) {
if(strpos($header, 'Location: ') === 0) {
return trim(substr($header,10));
}
}
return '';
}
function get_size($url) {
$my_ch = curl_init();
curl_setopt($my_ch, CURLOPT_URL,$url);
curl_setopt($my_ch, CURLOPT_HEADER, true);
curl_setopt($my_ch, CURLOPT_NOBODY, true);
curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($my_ch, CURLOPT_TIMEOUT,10);
$r = curl_exec($my_ch);
foreach(explode("\n", $r) as $header) {
if(strpos($header, 'Content-Length:') === 0) {
return trim(substr($header,16));
}
}
return '';
}
function get_description($url) {
$fullpage = curlGet($url);
$dom = new DOMDocument();
@$dom->loadHTML($fullpage);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="info-description-body"]');
foreach ($tags as $tag) {
$my_description .= (trim($tag->nodeValue));
}
return utf8_decode($my_description);
}
function get_mp3($url) {
$crl = curl_init();
curl_setopt_array($crl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_USERAGENT => getenv('HTTP_USER_AGENT'),
CURLOPT_HTTPHEADER => array('Accept: text/html, application/xml, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;', 'Accept-Language: ru, en, *;', 'Accept-Charset: iso-8859-1, utf-8, utf-16, *;', 'Accept-Encoding: identity;', 'Connection: close'),
));
$get_mp3 = curl_exec($crl);
curl_close($crl);
return $get_mp3;
}
function file_get($url) {
return implode("", file($url));
}
function seo_link($seolink){
return stro2(translit($seolink));
}
function seo_name($seoname){
return stro(translit($seoname));
}
function full_del_dir($directory)
{
$dir = opendir($directory);
while ($file = readdir($dir))
{
if (is_file($directory."/".$file))
{
@unlink($directory."/".$file);
}
else if (is_dir($directory."/".$file) && $file != "." && $file != "..")
{
full_del_dir($directory."/".$file);
}
}
@closedir($dir);
@rmdir($directory);
}
function count_files($dir){
$root = scandir($dir);
foreach($root as $value){
$size += filesize($dir.'/'.$value);
if($value === '.' || $value === '..') {continue;}
if(is_file($dir."/".$value)){$result[]=$dir."/".$value;continue;}
foreach(count_files($dir."/".$value) as $value)
{
$result[] = $value;
}
}
return array(count($result),$size);
}
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
return round($bytes, $precision) . '' . $units[$pow];
}
function users_to_site($IP,$BROWSER){
if(mysql_num_rows(mysql_query("SELECT `time` FROM `online` WHERE `code`='".base64_encode($IP.":".$BROWSER)."';"))=='0'){
mysql_query("INSERT INTO `online` Set `code`='".base64_encode($IP.":".$BROWSER)."', `time`='".time()."'");
}else{
mysql_query("UPDATE `online` SET `time`='".time()."' WHERE `code`='".base64_encode($IP.":".$BROWSER)."' and `time`<'".strtotime('-60 seconds')."' LIMIT 1;");
}
mysql_query("DELETE FROM `online` WHERE `time`<'".strtotime('-86400 seconds')."';");
return intval(mysql_num_rows(mysql_query("SELECT `time` FROM `online` WHERE `time`!='0';")));
}
function delete_online(){
$_DIR = @OPENDIR("online");
IF($_DIR == TRUE){
WHILE($_FILE = @READDIR($_DIR)){
IF($_FILE!= "." AND $_FILE!= ".." AND STRRCHR($_FILE, ".")==".dat"){
$TIME = @FILE("online/".$_FILE);
$TIME = TRIM($TIME[0]);
IF($TIME < TIME()){
@UNLINK("online/".$_FILE);
}
}
}
@CLOSEDIR($_DIR);
} else {
RETURN FALSE;
}
}
function contry($file) {
$file=str_replace('Ukraine','Ukrayna',$file);
$file=str_replace('Bulgaria','Bolqarıstan',$file);
$file=str_replace('Georgia','Gürcüstan',$file);
$file=str_replace('Sweden','İsveç',$file);
$file=str_replace('Thailand','Tailand',$file);
$file=str_replace('Kazakhstan','Qazaxıstan',$file);
$file=str_replace('Iceland','İslandiya',$file);
$file=str_replace('Club','Klub',$file);
$file=str_replace('Singapore','Sinqapur',$file);
$file=str_replace('Lithuania','Litva',$file);
$file=str_replace('World','Dünya',$file);
$file=str_replace('Lithuania','Litva',$file);
$file=str_replace('Friendlies','Yoldaşlıq',$file);
$file=str_replace('Indonesia','İndonezia',$file);
$file=str_replace('Norway','Norveç',$file);
$file=str_replace('USA','ABŞ',$file);
$file=str_replace('United States','ABŞ',$file);
$file=str_replace('Russian Federation','Rusiya Federasiyası',$file);
$file=str_replace('Europe','Avropa',$file);
$file=str_replace('United Kingdom','Birləşmiş Krallıq',$file);
$file=str_replace('Iran, Islamic Republic of','İran İslam Respublikası',$file);
$file=str_replace('India','Hindistan',$file);
$file=str_replace('League','Liqası',$file);
$file=str_replace('England','İngiltere',$file);
$file=str_replace('Ligue','Liqa',$file);
$file=str_replace('France','Fransa',$file);
$file=str_replace('Germany','Almanya',$file);
$file=str_replace('Italy','İtalya',$file);
$file=str_replace('Netherlands','Hollandiya',$file);
$file=str_replace('Portugal','Portuqaliya',$file);
$file=str_replace('Spain','İspaniya',$file);
$file=str_replace('Australia','Avstraliya',$file);
$file=str_replace('Austria','Avstriya',$file);
$file=str_replace('Belgium','Belçika',$file);
$file=str_replace('Croatia','Xorvatiya',$file);
$file=str_replace('Czech Republic','Çex Respublikası',$file);
$file=str_replace('Greece','Yunanıstan',$file);
$file=str_replace('Israel','İsrail',$file);
$file=str_replace('Mexico','Meksika',$file);
$file=str_replace('Poland','Polşa',$file);
$file=str_replace('Romania','Rumıniya',$file);
$file=str_replace('Scotland','Şotlandiya',$file);
$file=str_replace('Switzerland','İsveçrə',$file);
$file=str_replace('Turkey','Türkiyə',$file);
$file=str_replace('Azerbaijan','Azərbaycan',$file);
$file=str_replace('Bolivia','Boliviya',$file);
$file=str_replace('Brazil','Braziliya',$file);
$file=str_replace('Chile','Çili',$file);
$file=str_replace('Colombia','Kolumbiya',$file);
$file=str_replace('Costa Rica','Kosta Rika',$file);
$file=str_replace('Ecuador','Ekvador',$file);
$file=str_replace('Guatemala','Qvatemala',$file);
$file=str_replace('Luxembourg','Lüksemburq',$file);
$file=str_replace('Morocco','Morokko',$file);
$file=str_replace('Paraguay','Paraqvay',$file);
$file=str_replace('Tunisia','Tunis',$file);
$file=str_replace('Uruguay','Uruquay',$file);
$file=str_replace('Venezuela','Venesuela',$file);
$file=str_replace('Group','Qrup',$file);
$file=str_replace('Division','Diviziya',$file);
$file=str_replace('Championship','Çempionatı',$file);
$file=str_replace('Qabala','Qebele',$file);
$file=str_replace('Khazar Lenkoran','Xezer Lenkaran',$file);
$file=str_replace('Neftchi','Neftçi',$file);
$file=str_replace('Baku','Bakı',$file);
$file=str_replace('Kapaz','Kepez',$file);
$file=str_replace('Finland','Finlandiya',$file);
$file=str_replace('National','Milli',$file);
$file=str_replace('Japan','Yaponiya',$file);
$file=str_replace('Cup','Kuboku',$file);
$file=str_replace('Slovenia','Sloveniya',$file);
$file=str_replace('Wales','Uels',$file);
$file=str_replace('International','Beynəlxalq',$file);
$file=str_replace('Wales','Uels',$file);
$file=str_replace('Egypt','Misir',$file);
$file=str_replace('Cyprus','Kipr',$file);
$file=str_replace('Denmark','Danimarka',$file);
$file=str_replace('South Africa','Cənubi Afrika',$file);
$file=str_replace('Saudi Arabia','Saudi Ərəbistan',$file);
$file=str_replace('Soccer','Futbol',$file);
$file=str_replace('Stages','Stage',$file);
$file=str_replace('Stage','Mərhələsi',$file);
$file=str_replace('North','Şimal',$file);
$file=str_replace('South','Cənub',$file);
$file=str_replace('Conference','Konfrans',$file);
$file=str_replace('Ireland','İrlandiya',$file);
$file=str_replace('China','Çin',$file);
$file=str_replace('Uzbekistan','Özbəkstan',$file);
$file=str_replace('Africa','Afrika',$file);
$file=str_replace('Algeria','Əlcəzayir',$file);
$file=str_replace('Moscow','Moskva',$file);
return $file;
}
function page_chat($BASE_URL, $TOTAL, $MAX, $PAGE, $NEXT=TRUE){
echo '';
echo '';
$_NEXT = ($PAGE+1)*10+$MAX;
$_PREV = ($_NEXT);
$_NEXTPAGE = "Növbəti »";
$_PREVPAGE = "« Əvvəlki";
$TOTAL_P = CEIL($TOTAL/$MAX);
$STRING_P = FALSE;
IF($TOTAL_P==1){
RETURN FALSE;
}
$PAGE = ($PAGE*$MAX);
$ON_P = FLOOR($PAGE/$MAX)+1;
IF($ON_P==1){
$STRING_P .= '- « Əvvəlki
- '.$_NEXTPAGE.'
';
}
IF($ON_P==$TOTAL_P){
$STRING_P .= '- '.$_PREVPAGE.'
- Növbəti »
';
}
IF($NEXT){
IF($ON_P>1 && $ON_P<$TOTAL_P) {
$STRING_P = '- '.$_PREVPAGE.'
- '.$_NEXTPAGE.'
'.$STRING_P;
}
IF($ON_P<$TOTAL_P){
$STRING_P .= '';
}
}
RETURN "".$STRING_P."";
}
function page_next($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE){
echo '';
$total_pages = ceil($num_items/$per_page);
if ($total_pages == 1){
return '';
}
$start_item = $start_item * $per_page;
$on_page = floor($start_item / $per_page) + 1;
$page_string = '';
if ($on_page == 1){
//$page_string = 'Növbeti';
}
if ($on_page == $total_pages){
//$page_string = 'Evvelki';
}
if ($total_pages > 10){
$init_page_max = ($total_pages > 3) ? 3 : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++){
$page_string .= ($i == $on_page) ? '- '.$i.'
' : '- '.$i.'';
if ($i <$init_page_max){
$page_string .= ' ';
}
}
if ($total_pages > 3){
if ($on_page > 1&& $on_page < $total_pages){
$page_string .= ($on_page > 5) ? ' ' : ' ';
$init_page_min = ($on_page > 4) ? $on_page : 5;
$init_page_max = ($on_page < $total_pages - 4) ? $on_page : $total_pages - 4;
for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++){
$page_string .= ($i == $on_page) ? '
- '.$i.'
' : '- '.$i.'
';
if ($i <$init_page_max + 1){
$page_string .= ' ';
}
}
$page_string .= ($on_page < $total_pages - 4) ? ' ' : ' ';
}else{
$page_string .= ' ';
}
for($i = $total_pages - 2; $i < $total_pages + 1; $i++){
$page_string .= ($i == $on_page) ? '- '.$i.'
': '- '.$i.'
';
if($i <$total_pages){
$page_string .= ' ';
}
}
}
}else{
for($i = 1; $i < $total_pages + 1; $i++){
$page_string .= ($i == $on_page) ? '- '.$i.'
' : '- '.$i.'
';
if ($i <$total_pages){
$page_string .= ' ';
}
}
}
if ($add_prevnext_text){
if ($on_page > 1&& $on_page < $total_pages){
//$page_string = 'EvvelkiNövbeti'.$page_string;
}
if ($on_page < $total_pages){
$page_string .= '';
}
}
$page_string = $page_string.$select_list;
return $page_string."
";
echo '
';
}
function operator($ip){
@require("ips.inc");
foreach ($ip2_arr as $ip2){
if (ip2long($ip2[0]) <= ip2long($ip) && ip2long($ip2[1]) >= ip2long($ip)){
return $ip2[2];
}
}
return "null";
}
function delete_mp3($myfile){
global $set;
$oldtime = time() - $set['mp3_del_day'] * 24 * 60 * 60;
$dir = opendir($myfile);
while($file = readdir($dir)){
if($file != "." and $file != ".." and $file != ".htaccess" and filemtime($myfile."/".$file) < $oldtime){
@unlink($myfile."/".$file);
}else if(filesize($myfile."/".$file) < "300"){
@unlink($myfile."/".$file);
}
}
closedir($dir);
}
function cleen($var) {
return str_replace('–', '–', trim(mysql_real_escape_string(htmlentities($var, ENT_QUOTES, 'UTF-8'))));
}
function clean($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
}
function stro($str,$a_char = array("'","+","=","_"," ",".","~","!","[","]","(",")")){
$string = strtolower($str);
$string = str_replace($a_char, " ", $string);
foreach ($a_char as $temp){
$pos = strpos($string,$temp);
if ($pos){
$mend = '';
$a_split = explode($temp,$string);
foreach ($a_split as $temp2){
$mend .= ucfirst($temp2).$temp;
}
$string = substr($mend,0,-1);
}
}
return ucfirst($string);
}
function stro2($str,$a_char = array("'","_"," ",".","~","!","[","]","(",")","#","?")){
$string = strtolower($str);
$string = str_replace('video','mp3',$string);
$string = str_replace($a_char, "_", $string);
/*$string = str_replace(' ','_',$string);
$string = str_replace('--','_',$string);
$string = str_replace('---','_',$string);*/
$string = preg_replace('/&amp;amp;amp;amp;amp;amp;.+?;/', '_', $string);
//$string = preg_replace('/[^%a-z0-9 _-]/', '_', $string);
$string = preg_replace('/\s+/', '_', $string);
//$string = preg_replace('|-+|', '_', $string);
$string = trim($string, '_');
$string = str_replace("Ğ", "G", $string);
$string = str_replace("ğ", "g", $string);
$string = str_replace("Ə", "E", $string);
$string = str_replace("ə", "e", $string);
$string = str_replace("Ş", "S", $string);
$string = str_replace("ş", "s", $string);
$string = str_replace("Ç", "C", $string);
$string = str_replace("ç", "c", $string);
$string = str_replace("I", "I", $string);
$string = str_replace("İ", "I", $string);
$string = str_replace("ı", "i", $string);
$string = str_replace("Ö", "O", $string);
$string = str_replace("ö", "o", $string);
$string = str_replace("Ü", "U", $string);
$string = str_replace("ü", "u", $string);
$string = str_replace("<", "", $string);
foreach ($a_char as $temp){
$pos = strpos($string,$temp);
if ($pos){
$mend = '';
$a_split = explode($temp,$string);
foreach ($a_split as $temp2){
$mend .= trim($temp2).$temp;
}
$string = substr($mend,0,-1);
}
}
return trim($string);
}
function stro3($str,$a_char = array("'","-","_"," ",".","~","!","[","]","(",")","#","?")){
$string = strtolower($str);
$string = str_replace($a_char, "+", $string);
$string = str_replace(' ','+',$string);
$string = str_replace('--','+',$string);
$string = str_replace('---','+',$string);
$string = preg_replace('/&amp;amp;amp;amp;amp;amp;.+?;/', '+', $string);
$string = preg_replace('/[^%a-z0-9 _-]/', '+', $string);
$string = preg_replace('/\s+/', '+', $string);
$string = preg_replace('|-+|', '+', $string);
$string = trim($string, '+');
$string = str_replace("Ğ", "G", $string);
$string = str_replace("ğ", "g", $string);
$string = str_replace("Ə", "E", $string);
$string = str_replace("ə", "e", $string);
$string = str_replace("Ş", "S", $string);
$string = str_replace("ş", "s", $string);
$string = str_replace("Ç", "C", $string);
$string = str_replace("ç", "c", $string);
$string = str_replace("I", "I", $string);
$string = str_replace("İ", "I", $string);
$string = str_replace("ı", "i", $string);
$string = str_replace("Ö", "O", $string);
$string = str_replace("ö", "o", $string);
$string = str_replace("Ü", "U", $string);
$string = str_replace("ü", "u", $string);
$string = str_replace("<", "", $string);
foreach ($a_char as $temp){
$pos = strpos($string,$temp);
if ($pos){
$mend = '';
$a_split = explode($temp,$string);
foreach ($a_split as $temp2){
$mend .= trim($temp2).$temp;
}
$string = substr($mend,0,-1);
}
}
return trim($string);
}
function translit($str) {
$translate = array(
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
"Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I",
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"",
"Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j",
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"y",
"ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
"ё"=>"Yo","%20"=>"_"," "=>"_","Ü"=>"U","Ü"=>"U","ü"=>"u","ü"=>"u",
"Ç"=>"C","Ç"=>"C","ç"=>"c","ç"=>"c","Ş"=>"S","ş"=>"s","Ş"=>"S","ş"=>"s",
"Ə"=>"E","ə"=>"e","é"=>"e","Ə"=>"E","ə"=>"e","Ö"=>"O","ö"=>"o","Ö"=>"O","ö"=>"o",
"Ğ"=>"G","ğ"=>"g","Ğ"=>"G","ğ"=>"g","ı"=>"i","ı"=>"i","İ"=>"I");
return mb_substr(preg_replace('/[^a-z0-9_\-\[\]\!\?\.]/i', '', strtr($str, $translate)), 0, 240);
}
function size($size) {
if($size >= 1073741824) {
$size = round($size/1073741824*100) / 100 . ' Gb';
} elseif($size >= 1048576) {
$size = round($size/1048576*100) / 100 . ' Mb';
} elseif($size >= 1024) {
$size = round($size/1024*100) / 100 . ' Kb';
} else {
$size = round($size) . ' b';
}
return $size;
}
function getSizeFile($url) {
$x = array_change_key_case(get_headers($url, 1), CASE_LOWER);
return (strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0) ? $x['content-length'][1] : $x['content-length'];
}
function format_time($time) {
$format_time = $time;
if(preg_match("/(H)/i", $time)){
$format_time = str_replace('H',':',$time);
}
if(preg_match("/(M)/i", $time)){
$format_time = str_replace('M',':',$format_time);
$format_time = str_replace('PT','0',$format_time);
}else{
$format_time = str_replace('PT','PT:',$format_time);
$format_time = str_replace('PT','0',$format_time);
}
if(!preg_match("/(S)/i", $time)){
$format_time = $format_time.'00';
}
$format_time = str_replace('S','',$format_time);
$exp=explode(":", $format_time);
if(strlen($exp['0']) == '1') {
$format_time = '0'.$exp['0'].':'.$exp['1'];
}else if(strlen($exp['0']) == '3') {
$format_time = substr($exp['0'], 1, 3).':'.$exp['1'];
}
$exp=explode(":", $format_time);
if(strlen($exp['1']) == '1') {
$format_time = $exp['0'].':0'.$exp['1'];
}
return trim($format_time);
}
function end_time($time) {
$time = str_replace('PT','',$time);
$time = str_replace('H','',$time);
$time = str_replace('M','',$time);
$time = str_replace('S','',$time);
$time = str_replace('0','',$time);
$time = str_replace(':','',$time);
return trim($time);
}
function site(){
global $_SERVER;
$site = herf($_SERVER["HTTP_HOST"]);
if(preg_match("/www./i", strtolower($site))){
$site_2 = str_replace("www.", "", strtolower($site));
}else if(preg_match("/wap./i", strtolower($site))){
$site_2 = str_replace("wap.", "", strtolower($site));
}else if(preg_match("/chat./i", strtolower($site))){
$site_2 = str_replace("chat.", "", strtolower($site));
}else if(preg_match("/mp3./i", strtolower($site))){
$site_2 = str_replace("mp3.", "", strtolower($site));
}else{
$site_2 = strtolower($site);
}
return array($site,$site_2);
}
function herf($str,$a_char = array("'","-","+","=","_"," ",".","~","!","[","]","(",")")){
$string = strtolower($str);
foreach ($a_char as $temp){
$pos = strpos($string,$temp);
if ($pos){
$mend = '';
$a_split = explode($temp,$string);
foreach ($a_split as $temp2){
$mend .= ucfirst($temp2).$temp;
}
$string = substr($mend,0,-1);
}
}
return ucfirst($string);
}
?>