Файл: public_html/system/functions.php
Строк: 540
<?
function _string($string) {
$string = trim($string);
$string = mysql_escape_string($string);
$string = htmlspecialchars($string);
return $string;
}
function _num($i) {
$i = (int) abs($i);
return $i;
}
function NameBot(){
$array = array('q','w','r','t','p','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m');
$array2 = array('e','y','u','i','o','a');
$strlen = rand(5,6);
$name = '';
for($i = 1; $i <= $strlen; $i ++) {
if ($i == 1) {
$key = array_rand($array);
$name .= $array[$key];
}
elseif ($i == 2) {
$key = array_rand($array2);
$name .= $array2[$key];
}
elseif ($i <= 3) {
$key = array_rand($array);
$name .= $array[$key];
}
else
{
$key = array_rand($array);
$name .= $array[$key];
}
}
$name = mb_convert_case($name, MB_CASE_TITLE, "UTF-8");
return $name;
}
function time_count($timediff , $as = 0 , $ass = 0, $asss = 0, $assss = 0 , $text_view = 0, $text ='') {
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
if ($as == true && $dayfield != 0)
{
$d="$dayfield д.";
}else{
$d= NULL;
}
if ($ass == true && $hourfield != 0)
{
$h=" $hourfield ч. ";
}else{
$h= NULL;
}
if ($asss == true && $minutefield != 0)
{
$m=" $minutefield м. ";
}else{
$m= NULL;
}
if ($assss == true && $secondfield != 0)
{
$s=" ".$secondfield." с.";
}else{
$s= NULL;
}
if ($d <0 || $h < 0 || $m < 0 || $s < 0){
if ($text_view == true ){
if ($text == NULL)
$view= 'Время истекло';
else
$view= $text;
}else{
$view = NULL;
}
}else{
$view = $d . $h . $m . $s;
}
return $view;
}
function n_f($i) {
if($i >= 99999 && $i < 1000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'k';
}
elseif($i >= 999999 && $i < 1000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'m';
}
elseif($i >= 999999999 && $i < 1000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'b';
}
elseif($i >= 999999999999 && $i < 1000000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'t';
}
elseif($i >= 999999999999999 && $i < 1000000000000000000) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'q';
}
elseif($i >= 999999999999999999) {
$i = number_format($i, 0, '', '.');
$i = round($i,1).'u';
}else{
$i = number_format($i, 0, '', ''');
}
return $i;
}
function pages($path) {
global $page, $pages;
if(($page - 1) > 0) {
echo ' <a href="'.$path.'page=1"><<</a> ';
}else{
echo '<<';
}
if($page - 1 > 0) {
echo ' <a href="'.$path.'page='.($page - 1).'"><</a> ';
} else{
echo ' < ';
}
if($page == $pages && $page - 4 > 0) {
echo ' <a href="'.$path.'page='.($page - 4).'">'.($page - 4).'</a> ';
}
if($page == $pages && $page - 3 > 0) {
echo ' <a href="'.$path.'page='.($page - 3).'">'.($page - 3).'</a> ';
}
if($page - 2 > 0) {
echo ' <a href="'.$path.'page='.($page - 2).'">'.($page - 2).'</a> ';
}
if($page - 1 > 0) {
echo ' <a href="'.$path.'page='.($page - 1).'">'.($page - 1).'</a> ';
}
echo $page;
if($page + 1 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 1).'">'.($page + 1).'</a> ';
}
if($page + 2 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 2).'">'.($page + 2).'</a> ';
}
if($page == 1 && $page + 3 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 3).'">'.($page + 3).'</a> ';
}
if($page == 1 && $page + 4 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 4).'">'.($page + 4).'</a> ';
}
if($page + 1 <= $pages) {
echo ' <a href="'.$path.'page='.($page + 1).'">></a> ';
}else{
echo ' > ';
}
if(($page + 1) <= $pages) {
echo ' <a href="'.$path.'page='.$pages.'">>></a> ';
}else{
echo ' >> ';
}
}
function bbcode($str)
{
//$str = strip_tags($str);
//$str=preg_replace("/@(.+)@/Usi","<a href='/site.php?nick=\1'>\1</a>",$str);
//$str = preg_replace("/@(. )/si","<a href='/site.php?nick=\1'>\1</a>",$str);
$str=preg_replace("/[b](.+)[/b]/Usi","<strong>\1</strong>",$str);
$str=preg_replace("/[i](.+)[/i]/Usi","<em>\1</em>",$str);
$str=preg_replace("/[u](.+)[/u]/Usi","<u>\1</u>",$str);
$str=preg_replace("/[s](.+)[/s]/Usi","<s>\1</s>",$str);
//$str=preg_replace("/[b](.+)[/b]/Usi","<big>\1</big>",$str);
$str=preg_replace("/[small](.+)[/small]/Usi","<small>\1</small>",$str);
$str=preg_replace("/[sup](.+)[/sup]/Usi","<sup>\1</sup>",$str);
$str=preg_replace("/[sub](.+)[/sub]/Usi","<sub>\1</sub>",$str);
$str=preg_replace("/[code](.+)[/code]/Usi","<code>\1</code>",$str);
$str=preg_replace("/[color=(.*)](.*)[/color]/Usi", "<font color='\1'>\2</font>", $str);
$str=preg_replace("/[rang=(.*)](.*)[/rang]/Usi", "<div style='background-color:\1'>\2</div>", $str);
$str=preg_replace("/[size=(.*)](.*)[/size]/Usi", "<span style="font-size:\1">\2</span>", $str);
$str=preg_replace("/[img=(.*)]/Usi","<img src='\1' border="0"/>",$str);
$str=preg_replace("/[br]/Usi","<br>",$str);
$str=preg_replace("/[hr]/Usi","<hr>",$str);
//$str = preg_replace("/@(.*)/si","<a href='/site.php?nick=\1'>$1</a>",$str);
$str=preg_replace("/[url=(.*)](.*)[/url]/Usi","<a href='\1'>\2</a>",$str);
$str=preg_replace("/[center](.*)[/center]/Usi","<div align=center>\1</div>",$str);
$str=preg_replace("/[right](.*)[/right]/Usi","<div align=right>\1</div>",$str);
$str=preg_replace("/[left](.*)[/left]/Usi","<div align=left>\1</div>",$str);
$str=str_replace("rn","<br/>",$str);
return $str;
}
function bbfunc($str)
{
$str=preg_replace("/<strong>(. )</strong>/Usi","[b]\1[/b]",$str);
$str=preg_replace("/<em>(. )</em>/Usi","[i]\1[/i]",$str);
$str=preg_replace("/<u>(. )</u>/Usi","[u]\1[/u]",$str);
$str=preg_replace("/<s>(. )</s>/Usi","[s]\1[/s]",$str);
$str=preg_replace("/<big>(. )</big>/Usi","[big]\1[/big]",$str);
$str=preg_replace("/<small>(. )</small>/Usi","[small]\1[/small]",$str);
$str=preg_replace("/<sup>(. )</sup>/Usi","[sup]\1[/sup]",$str);
$str=preg_replace("/<sub>(. )</sub>/Usi","[sub]\1[/sub]",$str);
$str=preg_replace("/<code>(. )</code>/Usi","[code]\1[/code]",$str);
$str=preg_replace("/<br/>/Usi", "n", $str);
$str=preg_replace("/<span style="color:(.*)">(.*)</span>/Usi","[color=\1]\2[/color]", $str);
$str=preg_replace("/<span style="font-size:(.*)">(.*)</span>/Usi", "[size=\1]\2[/size]", $str);
$str=preg_replace("/<img src='(.*)' alt='(.*)' border="0"/>/Usi","[img=\1]\2[/img]",$str);
//$str = strip_tags($str);
return $str;
}
function smiles($string) {
$string = str_replace(array(':@)',':ded'), '<img src="/images/smiles/mini_ded.gif" alt="*"/>', $string);
$string = str_replace(array('O:-)','o:-)'),'<img src="/images/smiles/mini_angel.gif" alt="*"/>', $string);
$string = str_replace(array(']:-)',']:-]'),'<img src="/images/smiles/mini_diablo.gif" alt="*"/>', $string);
$string = str_replace(array(':$',':-$',':-['),'<img src="/images/smiles/mini_blush.gif" alt="*"/>', $string);
$string = str_replace(array(':))',':-))','-))','=))'),'<img src="/images/smiles/mini_lol.gif" alt="*"/>', $string);
$string = str_replace(array(':)',':-)','=)'),'<img src="/images/smiles/mini_ulibka.gif" alt="*"/>', $string);
$string = str_replace(array(';)',';-)'),'<img src="/images/smiles/mini_podmigivanie.gif" alt="*"/>', $string);
$string = str_replace(array(':-D',':-d',':D',')))'),'<img src="/images/smiles/mini_spin.gif" alt="*"/>', $string);
$string = str_replace(array(':-P',':-p',':-Р',':-р',':P',':p'),'<img src="/images/smiles/mini_yazyk.gif" alt="*"/>', $string);
$string = str_replace(array(':(',':-('),'<img src="/images/smiles/mini_sad.gif" alt="*"/>', $string);
$string = str_replace(array(':'(',':'-('),'<img src="/images/smiles/mini_cry.gif" alt="*"/>', $string);
$string = str_replace(array(':354',':354:'),'<img src="/images/smiles/354.gif" alt="*"/>', $string);
$string = str_replace(array(':]',':-]'),'<img src="/images/smiles/mini_dovolen.gif" alt="*"/>', $string);
$string = str_replace(array(':-/',':-\'),'<img src="/images/smiles/mini_hm.gif" alt="*"/>', $string);
$string = str_replace(array('8-)','%-)'),'<img src="/images/smiles/mini_krut.gif" alt="*"/>', $string);
$string = str_replace(array(':*',':-*'),'<img src="/images/smiles/mini_kiss.gif" alt="*"/>', $string);
$string = str_replace(array('%)','%-)'),'<img src="/images/smiles/mini_crazy.gif" alt="*"/>', $string);
$string = str_replace(array(':-o',':-O',':-о',':-О','O.o','О.о','O_o','o_O'),'<img src="/images/smiles/mini_chok.gif" alt="*"/>', $string);
$string = str_replace(array(':1004'),'<img src="/images/smiles/1004.gif" alt="*"/>', $string);
$string = str_replace(array(':1005'),'<img src="/images/smiles/1005.gif" alt="*"/>', $string);
$string = str_replace(array(':1006'),'<img src="/images/smiles/1006.gif" alt="*"/>', $string);
$string = str_replace(array(':1007'),'<img src="/images/smiles/1007.gif" alt="*"/>', $string);
$string = str_replace(array(':1008'),'<img src="/images/smiles/1008.gif" alt="*"/>', $string);
$string = str_replace(array(':1009'),'<img src="/images/smiles/1009.gif" alt="*"/>', $string);
$string = str_replace(array(':1010'),'<img src="/images/smiles/1010.gif" alt="*"/>', $string);
$string = str_replace(array(':1011'),'<img src="/images/smiles/1011.gif" alt="*"/>', $string);
$string = str_replace(array(':1012'),'<img src="/images/smiles/1012.gif" alt="*"/>', $string);
$string = str_replace(array(':1013'),'<img src="/images/smiles/1013.gif" alt="*"/>', $string);
$string = str_replace(array(':1014'),'<img src="/images/smiles/1014.gif" alt="*"/>', $string);
$string = str_replace(array(':1015'),'<img src="/images/smiles/1015.gif" alt="*"/>', $string);
$string = str_replace(array(':1016'),'<img src="/images/smiles/1016.gif" alt="*"/>', $string);
$string = str_replace(array(':da',':да'),'<img src="/images/smiles/agree.gif" alt="*"/>', $string);
$string = str_replace(array(':привет',':ку'),'<img src="/images/smiles/mini_bye.gif" alt="*"/>', $string);
$string = str_replace(array(':Ob',':ob'),'<img src="/images/smiles/mini_good.gif" alt="*"/>', $string);
$string = str_replace(array('6-(','%-E',':gigi'),'<img src="/images/smiles/mini_fingal.gif" alt="*"/>', $string);
$string = str_replace(array(':bravo',':браво'),'<img src="/images/smiles/mini_bravo.gif" alt="*"/>', $string);
$string = str_replace(array(':heart',':сердце'),'<img src="/images/smiles/mini_heart.gif" alt="*"/>', $string);
$string = str_replace(array(':fig',':фиг'),'<img src="/images/smiles/mini_fig.gif" alt="*"/>', $string);
$string = str_replace(array(':rose',':роза','@--'),'<img src="/images/smiles/mini_rose.gif" alt="*"/>', $string);
$string = str_replace(array(':krut',':крут'),'<img src="/images/smiles/mini_krut.gif" alt="*"/>', $string);
$string = str_replace(array(':ban',':банька'),'<img src="/images/smiles/mini_ban.gif" alt="*"/>', $string);
$string = str_replace(array(':clos',':закрыто'),'<img src="/images/smiles/mini_closed.gif" alt="*"/>', $string);
$string = str_replace(array('flyd',':флуд'),'<img src="http://tiwar.ru/images/smiles/mini_flood.gif" alt="*"/>', $string);
$string = str_replace(array(':bg','бедный'),'<img src="/images/smiles/mini_bg.gif" alt="*"/>', $string);
$string = str_replace(array(':az',':выпьем'),'<img src="/images/smiles/mini_az.gif" alt="*"/>', $string);
$string = str_replace(array(':bc',':сос'),'<img src="/images/smiles/mini_bc.gif" alt="*"/>', $string);
$string = str_replace(array(':bi'),'<img src="/images/smiles/mini_bi.gif" alt="*"/>', $string);
$string = str_replace(array(':904'),'<img src="/images/smiles/904.gif" alt="*"/>', $string);
$string = str_replace(array(':1000'),'<img src="/images/smiles/1000.gif" alt="*"/>', $string);
$string = str_replace(array(':1001'),'<img src="/images/smiles/1001.gif" alt="*"/>', $string);
$string = str_replace(array(':1002'),'<img src="/images/smiles/1002.gif" alt="*"/>', $string);
$string = str_replace(array(':1003'),'<img src="/images/smiles/1003.gif" alt="*"/>', $string);
$string = str_replace(array(':splat'),'<img src="/images/icon/plat.png" alt="*"/>', $string);
$string = str_replace(array(':m'),'<img src="/images/icon/mana.png" alt="*"/>', $string);
$string = str_replace(array(':g'),'<img src="/images/icon/gold.png" alt="*"/>', $string);
$string = str_replace(array(':s'),'<img src="/images/icon/silver.png" alt="*"/>', $string);
$string = str_replace(array(':a'),'<img src="/images/icon/arena.png" alt="*">[url=/arena]Aрена<img src="/images/icon/arena.png" alt="*"/>[/url]', $string);
$string = str_replace(array('dOOb','doob','d00b'),'<img src="/images/smiles/mini_friends.gif" alt="*"/>', $string);
$string=bbcode($string);
return $string;
}
function _time($i) {
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
return ($h > 0 ? ($h < 10 ? '0':'').$h.':':'').($m > 0 ? ($m < 10 ? '0':'').$m.':':'00:').($s > 0 ? ($s < 10 ? '0':'').$s:'00');
}
function bb($string) {
$string = str_replace("rn","<br/>",$string);
return $string;
}
function _timeban($i) {
$d = floor($i / 86400);
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
if($d > 0) {
$result = $d.' дней';
}
elseif($h > 0)
{
$result = $h.' ч.';
}elseif($m > 0)
{
$result = $m.' мин.';
}elseif($s >= 0)
{
$result = $s.' сек.';
}
return $result.' до окончания бана.';
}
function _times($i) {
$d = floor($i / 86400);
$h = floor(($i / 3600) - $d * 24);
$m = floor(($i - $h * 3600 - $d * 86400) / 60);
$s = $i - ($m * 60 + $h * 3600 + $d * 86400);
if($d > 0) {
$result = $d.' д';
}
elseif($h > 0)
{
$result = $h.' ч';
}elseif($m > 0)
{
$result = $m.' мин';
}elseif($s >= 0)
{
$result = $s.' сек';
}
return $result.' назад';
}
function vremja($time=NULL)
{
global $user;
if ($time==NULL)$time=time();
if (isset($user))$time=$time+$user['set_timesdvig']*60*60;
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($user)){
if ($time_p[0]==date("j n Y", time()+$user['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24-$user['set_timesdvig'])))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function p_1($l){ if($l == 1){ $result = 13400; } elseif($l == 2) { $result = 21700; } elseif($l == 3) { $result = 36100; } elseif($l == 4) { $result = 56000; } elseif($l == 5) { $result = 72000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } elseif($l == 11) { $result = 2100; } return $result; } function p_2($l){ if($l == 1){ $result = 9200; } elseif($l == 2) { $result = 11760; } elseif($l == 3) { $result = 22640; } elseif($l == 4) { $result = 35450; } elseif($l == 5) { $result = 56430; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function p_3($l){ if($l == 1){ $result = 11000; } elseif($l == 2) { $result = 22000; } elseif($l == 3) { $result = 33000; } elseif($l == 4) { $result = 44000; } elseif($l == 5) { $result = 55000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function p_4($l){ if($l == 1){ $result = 5000; } elseif($l == 2) { $result = 10000; } elseif($l == 3) { $result = 15000; } elseif($l == 4) { $result = 20000; } elseif($l == 5) { $result = 30000; } elseif($l == 6) { $result = 500; } elseif($l == 7) { $result = 1000; } elseif($l == 8) { $result = 1400; } elseif($l == 9) { $result = 2500; } elseif($l == 10) { $result = 1800; } return $result; } function up_1($l){ if($l == 1){ $result = 10; } elseif($l == 2) { $result = 15; } elseif($l == 3) { $result = 20; } elseif($l == 4) { $result = 25; } elseif($l == 5) { $result = 30; } elseif($l == 6) { $result = 35; } elseif($l == 7) { $result = 40; } elseif($l == 8) { $result = 45; } elseif($l == 9) { $result = 50; } elseif($l == 10) { $result = 55; } return $result; } function up_2($l){ if($l == 1){ $result = 11; } elseif($l == 2) { $result = 13; } elseif($l == 3) { $result = 15; } elseif($l == 4) { $result = 20; } elseif($l == 5) { $result = 25; } elseif($l == 6) { $result = 30; } elseif($l == 7) { $result = 35; } elseif($l == 8) { $result = 40; } elseif($l == 9) { $result = 45; } elseif($l == 10) { $result = 50; } return $result; } function up_3($l){ if($l == 1){ $result = 12; } elseif($l == 2) { $result = 18; } elseif($l == 3) { $result = 36; } elseif($l == 4) { $result = 48; } elseif($l == 5) { $result = 52; } elseif($l == 6) { $result = 66; } elseif($l == 7) { $result = 72; } elseif($l == 8) { $result = 18; } elseif($l == 9) { $result = 84; } elseif($l == 10) { $result = 90; } return $result; } function up_4($l){ if($l == 1){ $result = 4; } elseif($l == 2) { $result = 8; } elseif($l == 3) { $result = 12; } elseif($l == 4) { $result = 16; } elseif($l == 5) { $result = 20; } elseif($l == 6) { $result = 24; } elseif($l == 7) { $result = 28; } elseif($l == 8) { $result = 32; } elseif($l == 9) { $result = 36; } elseif($l == 10) { $result = 40; } return $result; } function cena_m2($id = 0){ $sell = mysql_fetch_array (mysql_query("SELECT * FROM `user_pets` WHERE `id` = '".$id."'")); $cena = mysql_fetch_array (mysql_query("SELECT * FROM `pets_tj` WHERE `name` = '".$sell ['name']."'")); $st = $cena['g']; if($cena['g'] != '0') { $default_money2 = $st / 2; } else { $default_money2 = '0'; } if($sell['tune_1'] < '6') { $tune_1_money2 = '0'; } elseif($sell['tune_1'] == '6') { $tune_1_money2 = '20'; } elseif($sell['tune_1'] == '7') { $tune_1_money2 = '70';
} elseif($sell['tune_1'] == '8') { $tune_1_money2 = '140'; } elseif($sell['tune_1'] == '9') { $tune_1_money2 = '280'; } elseif($sell['tune_1'] == '10') { $tune_1_money2 = '370'; } if($sell['tune_2'] < '6') { $tune_2_money2 = '0'; } elseif($sell['tune_2'] == '6') { $tune_2_money2 = '20'; } elseif($sell['tune_2'] == '7') { $tune_2_money2 = '70'; } elseif($sell['tune_2'] == '8') { $tune_2_money2 = '140'; } elseif($sell['tune_2'] == '9') { $tune_2_money2 = '280'; } elseif($sell['tune_2'] == '10') { $tune_2_money2 = '370'; } if($sell['tune_3'] < '6') { $tune_3_money2 = '0'; } elseif($sell['tune_3'] == '6') { $tune_3_money2 = '20'; } elseif($sell['tune_3'] == '7') { $tune_3_money2 = '70'; } elseif($sell['tune_3'] == '8') { $tune_3_money2 = '140'; } elseif($sell['tune_3'] == '9') { $tune_3_money2 = '280'; } elseif($sell['tune_3'] == '10') { $tune_3_money2 = '370'; } if($sell['tune_4'] < '6') { $tune_4_money2 = '0'; } elseif($sell['tune_4'] == '6') { $tune_4_money2 = '20'; } elseif($sell['tune_4'] == '7') { $tune_4_money2 = '70'; } elseif($sell['tune_4'] == '8') { $tune_4_money2 = '140'; } elseif($sell['tune_4'] == '9') { $tune_4_money2 = '280'; } elseif($sell['tune_4'] == '10') { $tune_4_money2 = '370'; } $count = $default_money2 + $tune_1_money2 + $tune_2_money2 + $tune_3_money2 + $tune_4_money2 ; if($count != 0) { $cnt = $count; } else { $cnt = '0'; } return intval($cnt); } function cena_m($id = 0){ $sell = mysql_fetch_array (mysql_query("SELECT * FROM `user_pets` WHERE `id` = '".$id."'")); $cena = mysql_fetch_array (mysql_query("SELECT * FROM `pets_tj` WHERE `name` = '".$sell ['name']."'")); $st = $cena['rubins']; if($cena['rubins'] != '0') { $default_money = $st / 2; } else { $default_money = '0'; } if($sell['tune_1'] == '2') { $tune_1_money = '670'; } elseif($sell['tune_1'] == '3') { $tune_1_money = '1755'; } elseif($sell['tune_1'] == '4') { $tune_1_money = '3560'; } elseif($sell['tune_1'] == '5') { $tune_1_money = '6360'; } elseif($sell['tune_1'] >= '6') { $tune_1_money = '9960'; } if($sell['tune_2'] == '2') { $tune_2_money = '4600'; } elseif($sell['tune_2'] == '3') { $tune_2_money = '1048'; } elseif($sell['tune_2'] == '4') { $tune_2_money = '2180'; } elseif($sell['tune_2'] == '5') { $tune_2_money = '3952'; } elseif($sell['tune_2'] >= '6') { $tune_2_money = '6773'; } if($sell['tune_3'] == '2') { $tune_3_money = '550'; } elseif($sell['tune_3'] == '3') { $tune_3_money = '1650'; } elseif($sell['tune_3'] == '4') { $tune_3_money = '3300'; } elseif($sell['tune_3'] == '5') { $tune_3_money = '5500'; } elseif($sell['tune_3'] >= '6') { $tune_3_money = '8250'; } if($sell['tune_4'] == '2') { $tune_4_money = '250'; } elseif($sell['tune_4'] == '3') { $tune_4_money = '750'; } elseif($sell['tune_4'] == '4') { $tune_4_money = '1500'; } elseif($sell['tune_4'] == '5') { $tune_4_money = '2500'; } elseif($sell['tune_4'] >= '6') { $tune_4_money = '4000'; } $count = $default_money + $tune_1_money + $tune_2_money + $tune_3_money + $tune_4_money; if($count != 0) { $cnt = $count; } else { $cnt = '0'; } return intval($cnt); }
?>