Файл: system/sys_func.php
Строк: 617
<?
// Авторизация юзера
session_start();
define('H', $_SERVER['DOCUMENT_ROOT'] .'/');
if (!isset($_SESSION['user_id'])) {
if (isset($_COOKIE['login']) && isset($_COOKIE['pass'])) {
$login = mysql_real_escape_string($_COOKIE['login']);
$pass = mysql_real_escape_string($_COOKIE['pass']);
$sql = mysql_query("SELECT `id` FROM `users` WHERE `login` = '". $login ."' AND `pass` = '". $pass ."' LIMIT 1");
if (mysql_num_rows($sql) == 1) {
$user = mysql_fetch_assoc($sql);
$_SESSION['user_id'] = $user['id'];
}
}
} elseif (isset($_SESSION['user_id'])) {
$sql = mysql_query("SELECT * FROM `users` WHERE `id` = '". $_SESSION['user_id'] ."'");
if (mysql_num_rows($sql) != 1) {
header('Location: /?logout');
exit;
}
$user = mysql_fetch_assoc($sql);
mysql_query("UPDATE `users` SET `time_last` = '". time() ."' WHERE `id` = '". $user['id'] ."' LIMIT 1");
} else {
$user = NULL;
}
// Временная зона
(isset($user) ? ''. date_default_timezone_set($user['timezone']) .'' : ''. date_default_timezone_set('Europe/Moscow') .'');
// Фильтрация данных
function filter($var) {
$return = trim(htmlspecialchars(mysql_real_escape_string($var)));
return $return;
}
// Шифровка
function in_md5($string) {
$pass = md5(md5($string));
$count_1 = strlen($pass);
$return = NULL;
for($i = 1; $i <= $count_1; $i++) {
$n = ($i == 1 ? 0 : $i-1);
$return .= md5(md5(substr($pass, $n, $i)));
}
return md5($return);
}
// Функция для правильново подсчёта кириллицы
function string($str) {
$ru = array('й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю');
return strlen(str_replace($ru, '0', $str));
}
// Обрезаем текст до первого пробела после n-го количества символов
function cut($str, $limit) {
$str = mb_substr($str, 0, $limit, 'UTF-8');
return substr($str, 0, strrpos($str, ' '));
}
// Вывод времени
function ptime($time = NULL) {
if ($time == NULL) $time = time();
$full_time = date('d.m.y, H:i', $time);
$date = date('d.m.y', $time);
$timep = date('H:i', $time);
if ($date == date('d.m.y')) $full_time = date('Сегодня, H:i', $time);
if ($date == date('d.m.y', time()-60*60*24)) $full_time = date('Вчера, H:i', $time);
return $full_time;
}
// Вывод времени
function pttime($time = NULL) {
if ($time == NULL) $time = time();
$sec = $time-time();
$days = floor(($time-time())/21600);
$h1 = floor(($time-time())/3600);
$m1 = floor(($time-time())/60);
$hour = floor($sec/60/60-$days*24);
$hours = floor($sec/60/60);
$min = floor($sec/60-$hours*60);
$ret = $days .'дней '. $h1 .'часа '. $m1 .'минут';
return $ret;
}
// Месяц
function mounth($time = NULL) {
if ($time == NULL) $time = time();
$mon = date('M', $time);
if ($mon == 'Jan') $mon = 'Январь';
if ($mon == 'Feb') $mon = 'Февраль';
if ($mon == 'Mar') $mon = 'Март';
if ($mon == 'Apr') $mon = 'Апрель';
if ($mon == 'May') $mon = 'Май';
if ($mon == 'Jun') $mon = 'Июнь';
if ($mon == 'Jul') $mon = 'Июль';
if ($mon == 'Aug') $mon = 'Август';
if ($mon == 'Sep') $mon = 'Сентябрь';
if ($mon == 'Oct') $mon = 'Октябрь';
if ($mon == 'Nov') $mon = 'Ноябрь';
if ($mon == 'Dec') $mon = 'Декабрь';
return $mon;
}
// День недели
function day($time = NULL) {
if ($time == NULL) $time = time();
$day = date('D', $time);
if ($day == 'Sun') $day = 'Воскресенье';
if ($day == 'Sat') $day = 'Суббота';
if ($day == 'Fri') $day = 'Пятница';
if ($day == 'Thu') $day = 'Четверг';
if ($day == 'Wed') $day = 'Среда';
if ($day == 'Tue') $day = 'Вторник';
if ($day == 'Mon') $day = 'Понедельник';
return $day;
}
// Приветствие
function p($time = NULL) {
if ($time == NULL) $time = time();
$p = date('H', $time);
if ($p < '06:00') $p = 'Доброй ночи';
if ($p < '12:00') $p = 'Доброе утро';
if ($p < '18:00') $p = 'Добрый день';
if ($p < '23:59') $p = 'Добрый вечер';
return $p;
}
// Постраничная навигация
function page($k_page = 1) {
$page = 1;
if (isset($_GET['page'])) {
if ($_GET['page'] == 'end') $page = intval($k_page);
elseif (is_numeric($_GET['page'])) $page = intval($_GET['page']);
}
if ($page < 1) $page = 1;
if ($page > $k_page) $page = $k_page;
return $page;
}
function k_page($k_post = 0, $k_p_str = 10) {
if ($k_post != 0) {
$v_pages = ceil($k_post/$k_p_str);
return $v_pages;
} else {
return 1;
}
}
function str($link = '?', $k_page = 1, $page = 1) {
if ($page < 1) $page = 1;
echo '<div class="post">';
if ($page > 1) echo '<a href="'. $link .'page='. ($page - 1) .'">« Назад</a> ';
if ($page > 1 && $page < $k_page) echo '<span style="color:#000;">|</span>';
if ($page < $k_page) echo ' <a href="'. $link .'page='. ($page + 1) .'">Вперед »</a>';
echo '<br>';
if ($page != 1) echo '<a href="'. $link .'page=1"><span class="unsel">1</span></a>';
else echo '<span class="sel">1</span>';
for ($ot = -3; $ot <= 3; $ot++) {
if ($page + $ot > 1 && $page + $ot < $k_page) {
if ($ot == -3 && $page + $ot > 3) echo " ..";
if ($ot != 0) echo ' <a href="'. $link .'page='. ($page + $ot) .'"><span class="unsel">'. ($page + $ot) .'</span></a>';
else echo ' <span class="sel">'. ($page + $ot) .'</span>';
if ($ot == 3 && $page + $ot < $k_page - 1) echo ' ..';
}
}
if ($page != $k_page) echo ' <a href="'. $link .'page=end"><span class="unsel">'. $k_page .'</span></a>';
elseif ($k_page > 1) echo ' <span class="sel">'. $k_page .'</span>';
echo '</div>';
}
// Смайлы
function smiles($msg) {
$msg = strtr($msg, array(':)' => '<img src="/design/smiles/smile.png" alt="smile" />',
':-)' => '<img src="/design/smiles/smile.png" alt="smile" />',
':(' => '<img src="/design/smiles/sad.png" alt="smile" />',
':-(' => '<img src="/design/smiles/sad.png" alt="smile" />',
':D' => '<img src="/design/smiles/grin.png" alt="smile" />',
':-D' => '<img src="/design/smiles/grin.png" alt="smile" />',
';)' => '<img src="/design/smiles/wink.png" alt="smile" />',
';-)' => '<img src="/design/smiles/wink.png" alt="smile" />',
':\' => '<img src="/design/smiles/think.png" alt="smile" />',
':-\' => '<img src="/design/smiles/think.png" alt="smile" />',
':'(' => '<img src="/design/smiles/cry.png" alt="smile" />',
':'-(' => '<img src="/design/smiles/cry.png" alt="smile" />',
':@' => '<img src="/design/smiles/angry.png" alt="smile" />',
':-@' => '<img src="/design/smiles/angry.png" alt="smile" />',
':O' => '<img src="/design/smiles/shock.png" alt="smile" />',
':-O' => '<img src="/design/smiles/shock.png" alt="smile" />',
':*' => '<img src="/design/smiles/kiss.png" alt="smile" />',
':-*' => '<img src="/design/smiles/kiss.png" alt="smile" />',
':x' => '<img src="/design/smiles/quiet.png" alt="smile" />',
':-x' => '<img src="/design/smiles/quiet.png" alt="smile" />',
'B)' => '<img src="/design/smiles/glasses.png" alt="smile" />',
'B-)' => '<img src="/design/smiles/glasses.png" alt="smile" />',
'8)' => '<img src="/design/smiles/glasses_nerdy.png" alt="smile" />',
'8-)' => '<img src="/design/smiles/glasses_nerdy.png" alt="smile" />',
'':|' => '<img src="/design/smiles/sweat.png" alt="smile" />',
'':-|' => '<img src="/design/smiles/sweat.png" alt="smile" />',
':P' => '<img src="/design/smiles/mad_tongue.png" alt="smile" />',
':-P' => '<img src="/design/smiles/mad_tongue.png" alt="smile" />',
'O:)' => '<img src="/design/smiles/angel.png" alt="smile" />',
'O:-)' => '<img src="/design/smiles/angel.png" alt="smile" />',
':S' => '<img src="/design/smiles/confused.png" alt="smile" />',
':-S' => '<img src="/design/smiles/confused.png" alt="smile" />',
':L' => '<img src="/design/smiles/loser.png" alt="smile" />',
':-L' => '<img src="/design/smiles/loser.png" alt="smile" />',
':T' => '<img src="/design/smiles/time_out.png" alt="smile" />',
':-T' => '<img src="/design/smiles/time_out.png" alt="smile" />',
':Z' => '<img src="/design/smiles/sleepy.png" alt="smile" />',
':-Z' => '<img src="/design/smiles/sleepy.png" alt="smile" />',
':?' => '<img src="/design/smiles/question.png" alt="smile" />',
':-?' => '<img src="/design/smiles/question.png" alt="smile" />',
':пока' => '<img src="/design/smiles/bye.png" alt="smile" />',
':гордый' => '<img src="/design/smiles/arrogant.png" alt="smile" />',
':хлоп' => '<img src="/design/smiles/clap.png" alt="smile" />',
':клоун' => '<img src="/design/smiles/clown.png" alt="smile" />',
':ковбой' => '<img src="/design/smiles/cowboy.png" alt="smile" />',
':мечта' => '<img src="/design/smiles/desire.png" alt="smile" />',
':бес' => '<img src="/design/smiles/devil.png" alt="smile" />',
':слюни' => '<img src="/design/smiles/drool.png" alt="smile" />',
':стеснит' => '<img src="/design/smiles/embarrassed.png" alt="smile" />',
':ботан' => '<img src="/design/smiles/glasses_nerdy.png" alt="smile" />',
':ухожу' => '<img src="/design/smiles/go_away.png" alt="smile" />',
':гипноз' => '<img src="/design/smiles/hypnotized.png" alt="smile" />',
':влюбви' => '<img src="/design/smiles/inlove.png" alt="smile" />',
':ресницы' => '<img src="/design/smiles/lashes.png" alt="smile" />',
':лол' => '<img src="/design/smiles/lol.png" alt="smile" />',
':лузер' => '<img src="/design/smiles/loser.png" alt="smile" />',
':безлюбви' => '<img src="/design/smiles/love_over.png" alt="smile" />',
':лгун' => '<img src="/design/smiles/lying.png" alt="smile" />',
':язык' => '<img src="/design/smiles/mad_tongue.png" alt="smile" />',
':мат' => '<img src="/design/smiles/mat.png" alt="smile" />',
':хитрый' => '<img src="/design/smiles/mean.png" alt="smile" />',
':ногти' => '<img src="/design/smiles/nailbiting.png" alt="smile" />',
':нейтрален' => '<img src="/design/smiles/neutral.png" alt="smile" />',
':насвязи' => '<img src="/design/smiles/on_the_phone.png" alt="smile" />',
':вечеринка' => '<img src="/design/smiles/party.png" alt="smile" />',
':вопрос' => '<img src="/design/smiles/question.png" alt="smile" />',
':ржу' => '<img src="/design/smiles/rofl.png" alt="smile" />',
':саркастик' => '<img src="/design/smiles/sarcastic.png" alt="smile" />',
':больной' => '<img src="/design/smiles/sick.png" alt="smile" />',
':глупый' => '<img src="/design/smiles/silly.png" alt="smile" />',
':сонный' => '<img src="/design/smiles/sleepy.png" alt="smile" />',
':капля' => '<img src="/design/smiles/sweat.png" alt="smile" />',
':дум' => '<img src="/design/smiles/think.png" alt="smile" />',
':таймаут' => '<img src="/design/smiles/time_out.png" alt="smile" />',
':жду' => '<img src="/design/smiles/waiting.png" alt="smile" />',
':слёзы' => '<img src="/design/smiles/weep.png" alt="smile" />',
':зеваю' => '<img src="/design/smiles/yawn.png" alt="smile" />',
':злой' => '<img src="/design/smiles/angry.png" alt="smile" />',
':улыбка' => '<img src="/design/smiles/smile.png" alt="smile" />',
':печаль' => '<img src="/design/smiles/sad.png" alt="smile" />',
':плачу' => '<img src="/design/smiles/cry.png" alt="smile" />',
':смех' => '<img src="/design/smiles/grin.png" alt="smile" />',
':подмиг' => '<img src="/design/smiles/wink.png" alt="smile" />',
':шок' => '<img src="/design/smiles/shock.png" alt="smile" />',
':поцелуй' => '<img src="/design/smiles/kiss.png" alt="smile" />',
':рот' => '<img src="/design/smiles/quiet.png" alt="smile" />',
':очки' => '<img src="/design/smiles/glasses.png" alt="smile" />',
':ангел' => '<img src="/design/smiles/angel.png" alt="smile" />',
':плохо' => '<img src="/design/smiles/confused.png" alt="smile" />',
':позвони' => '<img src="/design/smiles/call_me.png" alt="smile" />'));
return $msg;
}
// ББ-коды
function bbcode($msg) {
$bb = array('~[url=(.*?)?](.*?)[/url]~si' => '<a href="$1" target="_blank">$2</a>',
'/[b](.+)[/b]/isU' => '<b>$1</b>',
'/[u](.+)[/u]/isU' => '<span style="text-decoration:underline;">$1</span>',
'/[s](.+)[/s]/isU' => '<s>$1</s>',
'/[i](.+)[/i]/isU' => '<i>$1</i>',
'/[color=(.+)](.+)[/color]/isU' => '<span style="color:$1;">$2</span>',
'/[quote](.+)[/quote]/isU' => '<div class="quote">$1</div>');
$msg = preg_replace(array_keys($bb), array_values($bb), $msg);
return $msg;
}
// Подсветка PHP кода
function color_code($code) {
$code = html_entity_decode($code[0], ENT_QUOTES, 'UTF-8');
$code = trim($code);
$code = highlight_string($code, true);
return '<div style="overflow: scroll" class="quote">'. $code .'</div>';
}
function preg_replace_code($msg){
$msg = preg_replace_callback('#<?(.*?)?>#sui', 'color_code', $msg);
return $msg;
}
function output($msg) {
$msg = smiles(bbcode(preg_replace_code($msg)));
$msg = preg_replace('/\r\n/si', '<br/>', $msg);
return $msg;
}
// Функция вывода онлайна
function online($user = NULL) {
global $time;
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$user' LIMIT 1"));
if ($ank['position'] == 'admin') {
if ($ank['time_last'] > (time()-600)) {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/admin_man_on.png" alt="on"> ';
} else {
echo '<img src="/design/imgs/users/admin_woman_on.png" alt="on"> ';
}
} else {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/admin_man_off.png" alt="off"> ';
} else {
echo '<img src="/design/imgs/users/admin_woman_off.png" alt="off"> ';
}
}
}
if ($ank['position'] == 'mod_f' || $ank['position'] == 'mod_c') {
if ($ank['time_last'] > (time()-600)) {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/mod_man_on.png" alt="on"> ';
} else {
echo '<img src="/design/imgs/users/mod_woman_on.png" alt="on"> ';
}
} else {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/mod_man_off.png" alt="off"> ';
} else {
echo '<img src="/design/imgs/users/mod_woman_off.png" alt="off"> ';
}
}
}
if ($ank['position'] == 'user') {
if ($ank['time_last'] > (time()-600)) {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/man_on.png" alt="on"> ';
} else {
echo '<img src="/design/imgs/users/woman_on.png" alt="on"> ';
}
} else {
if ($ank['pol'] == '1') {
echo '<img src="/design/imgs/users/man_off.png" alt="off"> ';
} else {
echo '<img src="/design/imgs/users/woman_off.png" alt="off"> ';
}
}
}
}
//Вывод аватара
function avatar($user = NULL, $t = 'b') {
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '". $user ."' LIMIT 1"));
if (is_file(H.'files/avatars/'. $ank['avatar'])) {
echo '<a href="/files/avatars/'. $ank['avatar'] .'"><img src="/thumb.php?src=avatars/'. $ank['avatar'] .'&t='. $t .'"></a>';
} else {
if ($ank['pol'] == '1') echo '<img src="/design/imgs/no_avatar_man.png">';
elseif ($ank['pol'] == '0') echo '<img src="/design/imgs/no_avatar_woman.png">';
}
}
//Вывод информации
function user($user = NULL) {
// Определение браузера
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$user' LIMIT 1"));
$ua = strtolower($ank['agent']);
$path_pc = ' <img src="/design/imgs/PC.png" /> ';
$path_mob = ' <img src="/design/imgs/phone.png" /> ';
if ($ank['time_last'] > (time()-600)) {
// Компьютерные браузеры
if (preg_match('#(orca)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/orca.png" alt="" />';
elseif (preg_match('#(lunascape)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/lunascape.png" alt="" />';
elseif (preg_match('#(arora)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/arora.png" />';
elseif (preg_match('#(coolnovo)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/coolnovo.png" alt="" />';
elseif (preg_match('#(kylo)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/kylo.png" alt="" />';
elseif (preg_match('#(flock)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/flock.png" alt="" />';
elseif (preg_match('#(rockmelt)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/rockmelt.png" alt="" />';
elseif (preg_match('#(cometbird)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/cometbird.png" alt="" />';
elseif (preg_match('#(seamonkey)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/seamonkey.png" alt="" />';
elseif (preg_match('#(iron)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/iron.png" alt="" />';
elseif (preg_match('#(presto)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/opera.png" alt="" />';
elseif (preg_match('#(yabrowser)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/yabrowser.png" alt="" />';
elseif (preg_match('#(chrome)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/chrome.png" alt="" />';
elseif (preg_match('#(msie)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/msie.png" alt="" />';
elseif (preg_match('#(maxthon)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/maxthon.png" alt="" />';
elseif (preg_match('#(safari)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/safari.png" alt="" />';
elseif (preg_match('#(qtweb)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/qtweb.png" alt="" />';
elseif (preg_match('#(firefox)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/firefox.png" alt="" />';
// Мобильные браузеры
if (preg_match('#(sonyericsson)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/sony_ericsson.png" alt="" />';
elseif (preg_match('#(ipod)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(iphone)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(android)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/android.png" alt="" />';
elseif (preg_match('#(symbian)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/symbian.png" alt="" />';
elseif (preg_match('#(windowsphone)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp7)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp8)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(webos)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/hp.png" alt="" />';
elseif (preg_match('#(blackberry)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/blackberry.png" alt="" />';
elseif (preg_match('#(htc)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/htc.png" alt="" />';
elseif (preg_match('#(opera m)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/opera.png" alt="" />';
echo $browser;
$arr = array('nokia',
'samsung',
'siemens',
'fly',
'motorola',
'sharp',
'sony',
'lg',
'acer',
'alcatel',
'asus',
'gigabyte',
'highscreen',
'huawei',
'philips',
'mts',
'midp-2.0',
'ucweb');
foreach ($arr as $value) {
if (strpos($ua, $value) !== false) {
$browser = $path_mob;
echo $browser;
}
}
}
// Статус
if ($ank['status'] != NULL) echo '<br><span class="status"><img src="/design/imgs/star.png"> '. $ank['status'] .'</span>';
}
// Функция для удаления папки
function removeDirectory($dir) {
if ($objs = glob($dir.'/*')) {
foreach($objs as $obj) {
is_dir($obj) ? removeDirectory($obj) : unlink($obj);
}
}
rmdir($dir);
}
// Функция для определения размера файла
function size($num) {
if ($num >= 1000000000000) {
$num = round($num / 1099511627776, 1);
$unit = 'Тб';
} elseif ($num >= 1000000000) {
$num = round($num / 1073741824, 1);
$unit ='Гб';
} elseif ($num >= 1000000) {
$num = round($num / 1048576, 1);
$unit = 'Мб';
} elseif ($num >= 1000) {
$num = round($num / 1024, 1);
$unit = 'Кб';
} else {
$unit = 'б';
return number_format($num).' '.$unit;
}
return number_format($num, 1).' '.$unit;
}
function translit($string)
{
$rus = array("'",'`',',',' ',"Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
$eng = array('_','_','_','_',"JO","ZH","CH","SH","SCH","Je","Jy","Ja","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","","y");
return str_replace($rus, $eng, $string);
}
?>