<?php
function strip($mess){
$mess=str_replace("|","I",$mess);
$mess=str_replace("||","I",$mess);
$mess=htmlspecialchars($mess);
$mess=str_replace("'","'",$mess);
$mess=str_replace("\"",""",$mess);
$mess=str_replace("\$","$",$mess);
$mess=str_replace("$","$",$mess);
$mess=str_replace("\\","\", $mess);
$mess=str_replace("`","", $mess);
$mess=str_replace("^","^", $mess);
$mess=str_replace(":",":",$mess);
$mess=str_replace("%","%", $mess);
$mess=preg_replace("|:|",":",$mess,3);
$mess=mysql_escape_string(stripslashes(trim($mess)));
return $mess;
}
function get_login($id){
$id=intval($id);
$query=mysql_query("SELECT login FROM `users` WHERE id = '$id' LIMIT 1;")or die(mysql_error());
if(mysql_num_rows($query)==0){
$res='DELETED';
}else{
$res=strip(mysql_result($query,0,0)).' '.strip(mysql_result($query,0,1));
};
return $res;
};
function transliter($str){
static $tbl= array(
'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ж'=>'g', 'з'=>'z',
'и'=>'i', 'й'=>'y', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o', 'п'=>'p',
'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'ы'=>'i', 'э'=>'e', 'А'=>'A',
'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ж'=>'G', 'З'=>'Z', 'И'=>'I',
'Й'=>'Y', 'К'=>'K', 'Л'=>'L', 'М'=>'M', 'Н'=>'N', 'О'=>'O', 'П'=>'P', 'Р'=>'R',
'С'=>'S', 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Ы'=>'I', 'Э'=>'E', 'ё'=>"yo", 'х'=>"h",
'ц'=>"ts", 'ч'=>"ch", 'ш'=>"sh", 'щ'=>"shch", 'ъ'=>"", 'ь'=>"", 'ю'=>"yu", 'я'=>"ya",
'Ё'=>"YO", 'Х'=>"H", 'Ц'=>"TS", 'Ч'=>"CH", 'Ш'=>"SH", 'Щ'=>"SHCH", 'Ъ'=>"", 'Ь'=>"",
'Ю'=>"YU", 'Я'=>"YA", ' '=>"_"
);
return strtr($str, $tbl);
}
function formattime($file_time){
if($file_time >= 86400){
$file_time = round((($file_time / 60) / 60) / 24, 1). ' суток';
}elseif(
$file_time >= 3600){
$file_time = round(($file_time / 60) / 60, 1). ' часов';
}elseif(
$file_time >= 60){
$file_time = round($file_time / 60). ' минут';
}else{
$file_time = round($file_time). ' секунд';}
return $file_time;
}
function br($text,$br='<br>'){
$text=eregi_replace("((<br( ?/?)>)|\n|\r)+",$br, $text);
return $text;
}
function counter() {
session_set_cookie_params("0");
$id=session_id(); $time=time(); $past=time()-500;
mysql_query("DELETE FROM counter WHERE last_time < '$past'");
$result=mysql_query("SELECT last_time FROM counter WHERE sess_id='$id'");
$rows=mysql_num_rows($result);
if ($rows!="0") {
mysql_query("UPDATE counter SET last_time='$time' WHERE sess_id='$id'");
} else {
mysql_query("INSERT INTO counter (last_time, sess_id) VALUES ('$time', '$id')");
}
}
function antirek($str){
$str=strtr($str,array(".ru"=>"***",".com"=>"***",".net"=>"***",".org"=>"***",
".info"=>"***",".mobi"=>"***",".wen"=>"***",".kmx"=>"***",".h2m"=>"***"));
return $str;
}
function antimat($str){
$str=strtr($str,array("сука"=>"***","блядь"=>"***","блядь"=>"***","хуй"=>"***","пизда"=>"***"
,"сучка"=>"***","пидор"=>"***","пидар"=>"***","пидор"=>"***","пидрила"=>"***","чмо"=>"***","ебать"=>"***"));
return $str;
}
function case_onlines($onlineusers, $texts){
$str1 = substr($onlineusers, -1);
$str2 = substr($onlineusers, -2, -1);
if($str2 != 1 and $str1 == 1)
return $texts[0];
elseif($str2 != 1 and ($str1 == 2 or $str1 == 3 or $str1 == 4))
return $texts[1];
else return $texts[2];
}
function case_happy($years, $texts){
$str1 = substr($years, -1);
$str2 = substr($years, -2, -1);
if($str2 != 1 and $str1 == 1)
return $texts[0];
elseif($str2 != 1 and ($str1 == 2 or $str1 == 3 or $str1 == 4))
return $texts[1];
else return $texts[2];
}
?>