2022-08-25 17:08:08 +00:00
< ? php
2023-07-31 17:06:51 +00:00
use Core\Config ;
2023-04-15 19:18:30 +00:00
use Core\Database ;
use Core\Db ;
2023-08-10 14:04:23 +00:00
use Model\EkrExchangeRates ;
2023-04-15 19:18:30 +00:00
if ( ! defined ( 'GAME_VERSION' )) {
require_once '_incl_data/autoload.php' ;
}
2022-08-25 17:08:08 +00:00
2023-08-10 14:04:23 +00:00
$ekrPrices = new class {
/**
* @ var array | false
*/
private $data ;
public function __construct ()
{
$this -> data = Db :: getRow ( 'select RUB, USD, from_unixtime(id, ?) as date from ekr_exchange_rates order by id desc limit 1' , [ '%d.%m.%Y' ]);
if ( ! $this -> data ) {
$this -> data = [ 'RUB' => 0 , 'USD' => 0 ];
}
}
public function getRUBPrice ()
{
return $this -> data [ 'RUB' ];
}
public function getUSDPrice ()
{
return $this -> data [ 'USD' ];
}
};
$exchangeToday = new EkrExchangeRates ();
//10:05 Внимание! Вы успешно пополнили свой игровой счїт на <b>0.13 екр</b>. Приятной Вам игры!
2022-08-25 17:08:08 +00:00
2023-04-15 19:18:30 +00:00
Database :: init ();
2022-08-25 17:08:08 +00:00
$u = User :: start ();
if ( ! isset ( $u -> info [ 'id' ])) {
2023-03-31 18:30:14 +00:00
header ( 'location: /' );
2022-08-25 17:08:08 +00:00
die ();
2022-08-25 11:23:36 +00:00
}
2023-04-15 19:18:30 +00:00
$ball = Db :: getValue ( 'select sum(ekr) from pay_operation where uid = ? and good > 0' , [ $u -> info [ 'id' ]]);
2022-08-25 17:08:08 +00:00
2023-01-10 16:29:32 +00:00
$day1def = 50 ; //сколько екр. в день можно менять на кр.
$day2def = 1000 * ( $u -> info [ 'level' ] - 7 ); //сколько кр. в день можно менять на екр.
2022-08-25 11:23:36 +00:00
$day1 = $day1def ;
$day2 = $day2def ;
2022-08-25 17:08:08 +00:00
if ( $day2 < 0 ) {
$day2 = 0 ;
}
2022-08-25 11:23:36 +00:00
$timetoday = strtotime ( date ( 'd.m.Y' ));
2023-08-10 14:04:23 +00:00
$dc1 = Db :: getValue ( 'select sum(money2) from user_operation where time >= unix_timestamp() and uid = ? and type = ?' , [ $u -> info [ 'id' ], 'Обмен екр на кр' ]);
$dc2 = Db :: getValue ( 'select sum(money) from user_operation where time >= unix_timestamp() and uid = ? and type = ?' , [ $u -> info [ 'id' ], 'Обмен кр на екр' ]);
2022-08-25 11:23:36 +00:00
2022-08-25 17:08:08 +00:00
$day1 = round ( $day1 + $dc1 , 2 );
$day2 = round ( $day2 + $dc2 , 2 );
2022-08-25 11:23:36 +00:00
2022-08-25 17:08:08 +00:00
if ( $day1 < 0 ) {
$day1 = 0 ;
}
if ( $day2 < 0 ) {
$day2 = 0 ;
}
2022-08-25 11:23:36 +00:00
2023-01-10 16:29:32 +00:00
$b1 = 0 ; //бонус накопительный
2022-08-25 11:23:36 +00:00
2022-08-25 17:08:08 +00:00
$bns = [
[ 0 , 0 , 0 ],
[ 10 , 1 , 0 ],
[ 50 , 2 , 0 ],
[ 100 , 3 , 0 ],
[ 200 , 4 , 0 ],
[ 300 , 5 , 0 ],
[ 400 , 6 , 0 ],
[ 500 , 7 , 0 ],
[ 600 , 8 , 0 ],
[ 700 , 9 , 0 ],
[ 800 , 10 , 0 ],
[ 900 , 11 , 0 ],
[ 1000 , 13 , 1 ],
[ 1100 , 15 , 2 ],
[ 1200 , 17 , 3 ],
[ 1300 , 19 , 4 ],
[ 1500 , 21 , 5 ],
[ 1700 , 23 , 6 ],
[ 2000 , 25 , 7 ],
[ 2500 , 27 , 8 ],
[ 3000 , 30 , 9 ],
];
2022-08-25 11:23:36 +00:00
2022-08-25 17:08:08 +00:00
$bns2 = [
[ 0 , 0 ],
[ 10 , 10 ],
[ 20 , 10 ],
[ 30 , 10 ],
[ 40 , 10 ],
[ 50 , 10 ],
[ 60 , 10 ],
[ 70 , 10 ],
[ 80 , 10 ],
[ 90 , 10 ],
[ 100 , 20 ],
];
2022-08-25 11:23:36 +00:00
$i = 0 ;
2022-08-25 17:08:08 +00:00
while ( $i < count ( $bns )) {
if ( isset ( $bns [ $i ][ 0 ]) && $ball > $bns [ $i ][ 0 ]) {
$b1 = $i ;
}
$i ++ ;
2022-08-25 11:23:36 +00:00
}
2023-03-31 16:54:33 +00:00
if ( isset ( $_POST [ 'do' ]) && $_POST [ 'do' ] == 'newShadow' ) {
$o = mysql_fetch_array (
mysql_query (
'SELECT * FROM `_obraz` WHERE `uid` = "' . $u -> info [ 'id' ] . '" AND `good` = 0 AND `cancel` = 0 AND `img` = "' . mysql_real_escape_string (
$_POST [ 'ffinput' ]
) . '" LIMIT 1'
)
);
if ( ! isset ( $o [ 'id' ])) {
$u -> error = 'Данный образ не найден! Возможно он уже был подтвержден!' ;
} elseif ( $o [ 'price' ] > $u -> info [ 'money2' ]) {
2023-08-10 14:04:23 +00:00
$u -> error = 'Н а счету недостаточно екр' ;
2023-03-31 16:54:33 +00:00
} else {
//
$u -> info [ 'money2' ] -= $o [ 'price' ];
mysql_query (
'UPDATE `users` SET `money2` = "' . $u -> info [ 'money2' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1'
2022-08-25 17:08:08 +00:00
);
2023-03-31 16:54:33 +00:00
//
mysql_query ( 'UPDATE `_obraz` SET `good` = "' . time () . '" WHERE `id` = "' . $o [ 'id' ] . '" LIMIT 1' );
if ( $o [ 'type' ] == 1 || $o [ 'type' ] == 2 ) {
//Личный или Клановый
copy (
2023-07-31 17:06:51 +00:00
'clan_prw/' . $o [ 'img' ], './' . Config :: get ( 'img' ) . '/i/obraz/' . $o [ 'sex' ] . '/buy' . $o [ 'id' ] . '.gif'
2023-03-31 16:54:33 +00:00
);
} elseif ( $o [ 'type' ] == 3 ) {
//Питомец
2023-07-31 17:06:51 +00:00
copy ( 'clan_prw/' . $o [ 'img' ], './' . Config :: get ( 'img' ) . '/pet/buy' . $o [ 'id' ] . '.gif' );
2023-03-31 16:54:33 +00:00
} elseif ( $o [ 'type' ] == 5 ) {
//Питомец
2023-07-31 17:06:51 +00:00
copy ( 'clan_prw/' . $o [ 'img' ], './' . Config :: get ( 'img' ) . '/i/smile/s' . $o [ 'id' ] . '.gif' );
2023-03-31 16:54:33 +00:00
}
//
if ( $_POST [ 'ffsex' ] == 1 ) {
$o [ 'sex' ] = 1 ;
} elseif ( $_POST [ 'ffsex' ] == 0 ) {
$o [ 'sex' ] = 0 ;
}
//
if ( $o [ 'clan' ] > 0 ) {
$o [ 'uid1' ] = 0 ;
2022-08-25 17:08:08 +00:00
} else {
2023-03-31 16:54:33 +00:00
$o [ 'uid1' ] = $o [ 'uid' ];
}
//
if ( $o [ 'type' ] == 1 || $o [ 'type' ] == 2 ) {
//Личный и клановый
2022-08-25 17:08:08 +00:00
mysql_query (
2023-03-31 16:54:33 +00:00
' INSERT INTO `obraz` (
2022-08-25 11:23:36 +00:00
`sex` , `uid` , `img` , `usr_add` , `clan`
) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $o['sex'] . ' " , " ' . $o['uid1'] . ' " , " buy' . $o['id'] . '.gif " , " ' . $o['uid'] . ' " , " ' . $o['clan'] . ' "
) '
2023-03-31 16:54:33 +00:00
);
} elseif ( $o [ 'type' ] == 3 ) {
//Питомца
mysql_query (
' INSERT INTO `obraz_pet` (
2022-08-25 11:23:36 +00:00
`uid` , `time` , `img`
) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " , " ' . time() . ' " , " ' . mysql_real_escape_string('buy' . $o['id'] . '.gif') . ' "
) '
2023-03-31 16:54:33 +00:00
);
} elseif ( $o [ 'type' ] == 5 ) {
//Смайлик
$u -> info [ 'add_smiles' ] .= ',s' . $o [ 'id' ] . '' ;
$u -> info [ 'add_smiles' ] = ltrim ( $u -> info [ 'add_smiles' ], ',' );
mysql_query (
'UPDATE `users` SET `add_smiles` = "' . $u -> info [ 'add_smiles' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1'
);
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
//
if ( $o [ 'type' ] == 1 ) {
$u -> error = 'Личный образ успешно установлен! Можете выбрать е г о в инвентаре, в разделе Образ.' ;
} elseif ( $o [ 'type' ] == 2 ) {
$u -> error = 'Клановый образ успешно установлен! Можете выбрать е г о в инвентаре, в разделе Образ.' ;
} elseif ( $o [ 'type' ] == 3 ) {
$u -> error = 'Личный образ питомца успешно установлен! Можете выбрать е г о в инвентаре, в разделе Звери.' ;
} elseif ( $o [ 'type' ] == 5 ) {
$u -> error = 'Личный смайлик успешно установлен! Можете выбрать е г о в разделе Личные смайлики. Код смайлика <b>:s' . $o [ 'id' ] . ':</b>' ;
}
}
} elseif ( isset ( $_FILES [ 'img' ])) {
//Личный образ
$ekr = 100 ;
if ( $u -> info [ 'money2' ] < $ekr ) {
2023-08-10 14:04:23 +00:00
echo '{"err":"Н а счету недостаточно екр"}' ;
2023-03-31 16:54:33 +00:00
} else {
$obraz = 'f_shadow1_' . $u -> info [ 'id' ] . '-' . md5 (( time () - rand ( 0 , 1000 )) . '#shadow1' ) . '.gif' ;
$upload = new Uploader ( 'img' , $obraz );
$upload -> setSavePath ( 'clan_prw/' );
$upload -> setExtentions ( 'gif' );
$upload -> setMaxFileSize ( . 5 );
$upload -> setDimensions ( 120 , 220 );
//
if ( $file = $upload -> saveimg ()) {
mysql_query (
' INSERT INTO `_obraz` ( `uid` , `time` , `price` , `good` , `cancel` , `img` , `sex` , `type` , `clan` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " ,
" ' . time() . ' " ,
" ' . mysql_real_escape_string( $ekr ) . ' " ,
2022-08-25 11:23:36 +00:00
" 0 " ,
" 0 " ,
2022-08-25 17:08:08 +00:00
" ' . mysql_real_escape_string( $obraz ) . ' " ,
" ' . $u->info ['sex'] . ' " ,
2022-08-25 11:23:36 +00:00
" 1 " ,
" 0 "
2022-08-25 17:08:08 +00:00
) '
2023-03-31 16:54:33 +00:00
);
echo '{"img":"' . $obraz . '"}' ;
2022-08-25 17:08:08 +00:00
} else {
2023-03-31 16:54:33 +00:00
echo '{"err":"' . Uploader :: $error . '"}' ;
}
}
die ();
} elseif ( isset ( $_FILES [ 'img5' ])) {
//Личный смайлик
$ekr = 10 ;
$ekr_smile = 10 ;
if ( $u -> info [ 'money2' ] < $ekr ) {
2023-08-10 14:04:23 +00:00
echo '{"err":"Н а счету недостаточно екр"}' ;
2023-03-31 16:54:33 +00:00
} else {
$obraz = 'f_smile_' . $u -> info [ 'id' ] . '-' . md5 (( time () - rand ( 0 , 1000 )) . '#smile' ) . '.gif' ;
$upload = new Uploader ( 'img5' , $obraz );
$upload -> setSavePath ( 'clan_prw/' );
$upload -> setExtentions ( 'gif' );
$upload -> setMaxFileSize ( . 05 );
$upload -> setWidth ( 100 , 15 );
$upload -> setHeight ( 50 , 15 );
//
if ( $file = $upload -> saveimg ()) {
mysql_query (
' INSERT INTO `_obraz` ( `uid` , `time` , `price` , `good` , `cancel` , `img` , `sex` , `type` , `clan` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " ,
" ' . time() . ' " ,
" ' . mysql_real_escape_string( $ekr ) . ' " ,
2022-08-25 11:23:36 +00:00
" 0 " ,
" 0 " ,
2022-08-25 17:08:08 +00:00
" ' . mysql_real_escape_string( $obraz ) . ' " ,
2022-08-25 11:23:36 +00:00
" 0 " ,
" 5 " ,
" 0 "
2022-08-25 17:08:08 +00:00
) '
2023-03-31 16:54:33 +00:00
);
echo '{"img":"' . $obraz . '"}' ;
2022-08-25 17:08:08 +00:00
} else {
2023-03-31 16:54:33 +00:00
echo '{"err":"' . Uploader :: $error . '"}' ;
}
}
die ();
} elseif ( isset ( $_FILES [ 'img2' ])) {
//Клановый образ
$ekr = 49.99 ;
if ( $u -> info [ 'clan' ] == 0 ) {
echo '{"err":"Вы должны состоять в клане"}' ;
} elseif ( $u -> info [ 'money2' ] < $ekr ) {
2023-08-10 14:04:23 +00:00
echo '{"err":"Н а счету недостаточно екр"}' ;
2023-03-31 16:54:33 +00:00
} else {
$obraz = 'f_shadow2_' . $u -> info [ 'id' ] . '-' . md5 (( time () - rand ( 0 , 1000 )) . '#shadow2' ) . '.gif' ;
$upload = new Uploader ( 'img2' , $obraz );
$upload -> setSavePath ( 'clan_prw/' );
$upload -> setExtentions ( 'gif' );
$upload -> setMaxFileSize ( . 3 );
$upload -> setDimensions ( 120 , 220 );
//
if ( $file = $upload -> saveimg ()) {
mysql_query (
' INSERT INTO `_obraz` ( `uid` , `time` , `price` , `good` , `cancel` , `img` , `sex` , `type` , `clan` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " ,
" ' . time() . ' " ,
" ' . mysql_real_escape_string( $ekr ) . ' " ,
2022-08-25 11:23:36 +00:00
" 0 " ,
" 0 " ,
2022-08-25 17:08:08 +00:00
" ' . mysql_real_escape_string( $obraz ) . ' " ,
" ' . $u->info ['sex'] . ' " ,
2022-08-25 11:23:36 +00:00
" 2 " ,
2022-08-25 17:08:08 +00:00
" ' . $u->info ['clan'] . ' "
) '
2023-03-31 16:54:33 +00:00
);
echo '{"img":"' . $obraz . '"}' ;
2022-08-25 17:08:08 +00:00
} else {
2023-03-31 16:54:33 +00:00
echo '{"err":"' . Uploader :: $error . '"}' ;
}
}
die ();
} elseif ( isset ( $_FILES [ 'img4' ])) {
//Питомец образ
$ekr = 4.99 ;
if ( $u -> info [ 'money2' ] < $ekr ) {
2023-08-10 14:04:23 +00:00
echo '{"err":"Н а счету недостаточно екр"}' ;
2023-03-31 16:54:33 +00:00
} else {
$obraz = 'f_shadow3_' . $u -> info [ 'id' ] . '-' . md5 (( time () - rand ( 0 , 1000 )) . '#shadow3' ) . '.gif' ;
$upload = new Uploader ( 'img4' , $obraz );
$upload -> setSavePath ( 'clan_prw/' );
$upload -> setExtentions ( 'gif' );
$upload -> setMaxFileSize ( . 3 );
$upload -> setDimensions ( 120 , 40 );
//
if ( $file = $upload -> saveimg ()) {
mysql_query (
' INSERT INTO `_obraz` ( `uid` , `time` , `price` , `good` , `cancel` , `img` , `sex` , `type` , `clan` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " ,
" ' . time() . ' " ,
" ' . mysql_real_escape_string( $ekr ) . ' " ,
2022-08-25 11:23:36 +00:00
" 0 " ,
" 0 " ,
2022-08-25 17:08:08 +00:00
" ' . mysql_real_escape_string( $obraz ) . ' " ,
" ' . $u->info ['sex'] . ' " ,
2022-08-25 11:23:36 +00:00
" 3 " ,
2022-08-25 17:08:08 +00:00
" ' . $u->info ['clan'] . ' "
) '
);
2023-03-31 16:54:33 +00:00
echo '{"img":"' . $obraz . '"}' ;
} else {
echo '{"err":"' . Uploader :: $error . '"}' ;
}
}
die ();
} elseif ( isset ( $_POST [ 'kr001' ])) {
//Обмен екр на кр.
$kr = round ( $_POST [ 'kr001' ], 2 );
2023-08-10 14:04:23 +00:00
if ( Config :: KR_TO_EKR_EXCHANGE < 0.01 ) {
2023-03-31 16:54:33 +00:00
$u -> error = 'Сегодня обменник закрыт.' ;
} elseif ( $day2 < 0.01 ) {
$u -> error = 'Сегодня для вас обмен закрыт, приходите завтра.' ;
2023-08-10 14:04:23 +00:00
} elseif ( $kr < round ( Config :: KR_TO_EKR_EXCHANGE / 100 , 2 )) {
$u -> error = 'Минимальная сумма обмена ' . round ( Config :: KR_TO_EKR_EXCHANGE / 100 , 2 ) . ' кр.' ;
2023-03-31 16:54:33 +00:00
} elseif ( $kr > $day2 ) {
2023-08-10 14:04:23 +00:00
$u -> error = 'Вы можете обменять еще ' . $day2 . ' кр сегодня.' ;
2023-03-31 16:54:33 +00:00
} elseif ( $kr > $u -> info [ 'money' ]) {
$u -> error = 'Недостаточно денег для обмена.' ;
} else {
2023-08-10 14:04:23 +00:00
$ekr = round ( $kr / Config :: KR_TO_EKR_EXCHANGE , 2 );
$u -> error = 'Вы успешно обменяли ' . $kr . ' кр на ' . $ekr . ' екр.' ;
2023-03-31 16:54:33 +00:00
//
$u -> info [ 'money' ] -= $kr ;
$u -> info [ 'money2' ] += $ekr ;
//
mysql_query (
'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '",`money2` = "' . $u -> info [ 'money2' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1'
);
mysql_query (
' INSERT INTO `user_operation` ( `uid` , `time` , `money` , `money2` , `type` , `b1` , `b2` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " , " ' . time() . ' " , " ' . round(- $kr , 2) . ' " , " ' . round(
2023-03-31 16:54:33 +00:00
$ekr , 2
2023-08-10 14:04:23 +00:00
) . '","Обмен кр на екр","' . $u -> info [ 'money' ] . '","' . $u -> info [ 'money2' ] . ' "
2022-08-25 17:08:08 +00:00
) '
);
2023-03-31 16:54:33 +00:00
}
$dc1 = mysql_fetch_array (
mysql_query (
2023-08-10 14:04:23 +00:00
'SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `type` = "Обмен екр на кр" LIMIT 1'
2023-03-31 16:54:33 +00:00
)
);
$dc2 = mysql_fetch_array (
mysql_query (
2023-08-10 14:04:23 +00:00
'SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `type` = "Обмен кр на екр" LIMIT 1'
2023-03-31 16:54:33 +00:00
)
);
$dc1 = $dc1 [ 0 ];
$dc2 = $dc2 [ 0 ];
$day1 = round ( $day1def + $dc1 , 2 );
$day2 = round ( $day2def + $dc2 , 2 );
} elseif ( isset ( $_POST [ 'ekr2' ])) {
//Обмен екр на кр.
$ekr = round ( $_POST [ 'ekr2' ], 2 );
2023-08-10 14:04:23 +00:00
if ( Config :: EKR_TO_KR_EXCHANGE < 0.01 ) {
2023-03-31 16:54:33 +00:00
$u -> error = 'Сегодня обменник закрыт.' ;
} elseif ( $day1 < 0.01 ) {
$u -> error = 'Сегодня для вас обмен закрыт, приходите завтра.' ;
} elseif ( $ekr < 0.01 ) {
2023-08-10 14:04:23 +00:00
$u -> error = 'Минимальная сумма обмена 0.01 екр.' ;
2023-03-31 16:54:33 +00:00
} elseif ( $ekr > $day1 ) {
2023-08-10 14:04:23 +00:00
$u -> error = 'Вы можете обменять еще ' . $day1 . ' екр сегодня.' ;
2023-03-31 16:54:33 +00:00
} elseif ( $ekr > $u -> info [ 'money2' ]) {
$u -> error = 'Недостаточно денег для обмена.' ;
} else {
2023-08-10 14:04:23 +00:00
$kr = round ( $ekr * Config :: EKR_TO_KR_EXCHANGE , 2 );
$u -> error = 'Вы успешно обменяли ' . $ekr . ' екр на ' . $kr . ' кр.' ;
2023-03-31 16:54:33 +00:00
//
$u -> info [ 'money' ] += $kr ;
$u -> info [ 'money2' ] -= $ekr ;
//
mysql_query (
'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '",`money2` = "' . $u -> info [ 'money2' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1'
2022-08-25 17:08:08 +00:00
);
2023-03-31 16:54:33 +00:00
mysql_query (
' INSERT INTO `user_operation` ( `uid` , `time` , `money` , `money2` , `type` , `b1` , `b2` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " , " ' . time() . ' " , " ' . round( $kr , 2) . ' " , " ' . round(
2023-03-31 16:54:33 +00:00
- $ekr , 2
2023-08-10 14:04:23 +00:00
) . '","Обмен екр на кр","' . $u -> info [ 'money' ] . '","' . $u -> info [ 'money2' ] . ' "
2022-08-25 17:08:08 +00:00
) '
);
2023-03-31 16:54:33 +00:00
}
$dc1 = mysql_fetch_array (
mysql_query (
2023-08-10 14:04:23 +00:00
'SELECT SUM(`money2`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `type` = "Обмен екр на кр" LIMIT 1'
2023-03-31 16:54:33 +00:00
)
);
$dc2 = mysql_fetch_array (
mysql_query (
2023-08-10 14:04:23 +00:00
'SELECT SUM(`money`) FROM `user_operation` WHERE `time` >= "' . $timetoday . '" AND `uid` = "' . $u -> info [ 'id' ] . '" AND `type` = "Обмен кр на екр" LIMIT 1'
2023-03-31 16:54:33 +00:00
)
);
$dc1 = $dc1 [ 0 ];
$dc2 = $dc2 [ 0 ];
$day1 = round ( $day1def + $dc1 , 2 );
$day2 = round ( $day2def + $dc2 , 2 );
} elseif ( isset ( $_POST [ 'login' ])) {
//
function en_ru ( $txt )
{
$g = false ;
$en = preg_match ( " /^(([0-9a-zA-Z _-])+) $ /i " , $txt );
$ru = preg_match ( " /^(([0-9а -яА-Я _-])+) $ /i " , $txt );
if (( $ru && $en ) || ( ! $ru && ! $en )) {
$g = true ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
return $g ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
//
function testBad ( $txt )
{
$white = '-_ 0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMїЙЦУ К Е Н ГШЩЗ Х ЪФЫВ А ПР О ЛДЖЭЯЧС М ИТ Ь БЮїйцу ке нг шщзх ъфыва пр о лджэячс митьб ю' ;
$r = false ;
$i = 0 ;
while ( $i != - 1 ) {
if ( isset ( $txt [ $i ])) {
$g = false ;
$j = 0 ;
while ( $j != - 1 ) {
if ( isset ( $white [ $j ])) {
if ( $white [ $j ] == $txt [ $i ]) {
$g = true ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
} else {
$j = - 2 ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
$j ++ ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
if ( ! $g ) {
$r = true ;
}
} else {
$i = - 2 ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
$i ++ ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
return $r ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
function is_login ( $login )
{
$r = true ;
//
$login = htmlspecialchars ( $login , null );
//
$bad = [
'Мусорщик' => 1 ,
'Мироздатель' => 1 ,
];
2023-08-10 14:04:23 +00:00
2023-03-31 16:54:33 +00:00
//
$login_db = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `users` WHERE `login` = "' . mysql_real_escape_string ( $login ) . '" LIMIT 1'
)
);
if ( isset ( $login_db [ 'id' ]) || isset ( $bad [ $login ])) {
$r = false ;
} else {
$true = true ;
2022-08-25 17:08:08 +00:00
//
2023-03-31 16:54:33 +00:00
/*
Логин может содержать от 4 до 16 символов , и состоять только из букв русского ИЛИ английского алфавита , цифр , символов '_' , '-' и пробела .
Логин не может начинаться или заканчиваться символами '_' , '-' или пробелом .
*/
2022-08-25 17:08:08 +00:00
//
2023-03-31 16:54:33 +00:00
$login = str_replace ( ' ' , ' ' , $login );
$login = str_replace ( '%' , ' ' , $login );
$login = str_replace ( ' ' , ' ' , $login );
2022-08-25 17:08:08 +00:00
//
2023-03-31 16:54:33 +00:00
if ( strlen ( $login ) > 16 ) {
$true = false ;
} elseif ( strlen ( $login ) < 4 ) {
$true = false ;
} elseif ( strripos ( $login , ' ' ) == true ) {
$true = false ;
} elseif ( substr ( $login , 1 ) == ' ' || substr ( $login , - 1 ) == ' ' ) {
$true = false ;
} elseif ( substr ( $login , 1 ) == '-' || substr ( $login , - 1 ) == '-' ) {
$true = false ;
} elseif ( substr ( $login , 1 ) == '_' || substr ( $login , - 1 ) == '_' ) {
$true = false ;
} elseif ( testBad ( $login ) == true ) {
$true = false ;
} elseif ( en_ru ( str_replace ( 'ї' , 'е ' , str_replace ( 'ї' , 'Е ' , $login ))) == true ) {
$true = false ;
}
//
if ( $true == false ) {
2022-08-25 17:08:08 +00:00
$r = false ;
} else {
2023-03-31 16:54:33 +00:00
$r = true ;
2022-08-25 17:08:08 +00:00
}
}
2023-03-31 16:54:33 +00:00
return $r ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
if ( $u -> info [ 'login' ] == $_POST [ 'login' ]) {
$u -> error = 'Выберите другой логин...' ;
} elseif ( $u -> info [ 'money2' ] < 25 ) {
$u -> error = 'Недостаточно средств.' ;
} else {
$login = htmlspecialchars ( $_POST [ 'login' ], null );
if ( is_login ( $login ) == true ) {
mysql_query (
' INSERT INTO `lastnames` ( `uid` , `login` , `newlogin` , `time` ) VALUES (
2022-08-25 17:08:08 +00:00
" ' . $u->info ['id'] . ' " , " ' . $u->info ['login'] . ' " , " ' . mysql_real_escape_string(
2023-03-31 16:54:33 +00:00
$login
) . '","' . time () . ' "
2022-08-25 17:08:08 +00:00
) '
2023-03-31 16:54:33 +00:00
);
$u -> info [ 'login_last' ] = $u -> info [ 'login' ];
$u -> info [ 'login' ] = $login ;
$u -> info [ 'money2' ] -= 25 ;
2022-08-25 17:08:08 +00:00
//
2023-03-31 16:54:33 +00:00
mysql_query (
" UPDATE `items_users` SET `data` = replace( `data` , 'sudba= " . $u -> info [ 'login_last' ] . " ', 'sudba= " . mysql_real_escape_string (
$u -> info [ 'login' ]
) . " ') WHERE `data` LIKE '%sudba= " . mysql_real_escape_string (
$u -> info [ 'login_last' ]
) . " %' AND `uid` = ' " . $u -> info [ 'id' ] . " ' "
);
//
mysql_query (
'UPDATE `users` SET `login` = "' . mysql_real_escape_string (
$u -> info [ 'login' ]
) . '", `money2` = "' . $u -> info [ 'money2' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1'
);
$u -> error = 'Вы успешно сменили логин на "' . $u -> info [ 'login' ] . '" перезайдите в игру с главной страницы.' ;
} else {
$u -> error = 'Выберите другой логин...' ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
}
} elseif ( isset ( $_GET [ 'buy_ekr' ])) {
//
$mrh_login = " 15922 " ; //"65643";
$mrh_pass1 = " 6?ljVLf]RSiBM2F " ;
//
$inv_id = 0 ;
//
$out_ekr = round ( $_POST [ 'ekr' ], 2 );
if ( $out_ekr < 0 ) {
2022-08-25 17:08:08 +00:00
//
2023-03-31 16:54:33 +00:00
$out_ekr = 0 ;
}
2023-08-10 14:04:23 +00:00
$out_summ = round ( $out_ekr * $exchangeToday -> oneEkrInRUB (), 2 );
2023-03-31 16:54:33 +00:00
$inv_desc = 'Приобрести ' . $out_ekr . ' екр., персонаж №' . $u -> info [ 'id' ] . ', дилер №' . round (
( int ) $_POST [ 'ref' ]
) . '' ;
//
$shp_item = 0 ;
//
//Бонус опытовый, первичный и накопительный
$out_ekr0 = $out_ekr ;
//
$out_ekr += round ( $out_ekr0 / 100 * $bns [ $b1 ][ 1 ], 2 );
$i = 0 ;
while ( $i < count ( $bns2 )) {
if ( isset ( $bns2 [ $i ][ 0 ]) && $out_ekr >= $bns2 [ $i ][ 0 ]) {
$b2_2 = $i ;
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
$i ++ ;
}
$out_ekr += round ( $out_ekr0 / 100 * $bns2 [ $b2_2 ][ 1 ], 2 );
if ( $ball == 0 ) {
$out_ekr += round ( $out_ekr0 / 100 * 20 , 2 );
}
//
//Добавляем в базу
2023-07-11 15:16:35 +00:00
Db :: sql ( ' insert into pay_operation ( uid , code , ekr , time , good , cur , var , val , ref , ref2 , ip , date )
VALUES ( ? , ? , ? , unix_timestamp (), 0 , ? , ? , 0 , ? , ? , ? , ? ) ' ,
[
$u -> info [ 'id' ],
$_GET [ 'code' ],
$out_ekr ,
$cur [ 'cur' ],
'buy_ekr' ,
$u -> info [ 'host_reg' ],
$_GET [ 'ref' ],
IP ,
2023-07-31 17:06:51 +00:00
date ( 'Y-m-d H:i:s' ),
2023-07-11 15:16:35 +00:00
]);
$shp_item = Db :: lastInsertId ();
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
if ( $shp_item <= 0 ) {
die ( 'Ошибка в обработке платежа, обратитесь к Администрации' );
2022-08-25 17:08:08 +00:00
}
2023-03-31 16:54:33 +00:00
if ( $out_ekr < 1 ) {
die ( 'Минимальная сумма покупки 1 екр.' );
}
//
// предлагаемая валюта платежа
// default payment e-currency
$in_curr = " " ;
// язык
// language
$culture = " ru " ;
$currency = " RUB " ;
// формирование подписи
// generate signature
//md5( merchant_id : order_amount : secret_word : currency : order_id)
$crc = md5 ( $mrh_login . ':' . $out_summ . ':' . $mrh_pass1 . ':' . $currency . ':' . $shp_item );
// форма оплаты товара
// payment form
$url = 'https://pay.freekassa.ru/?' ;
$url .= 'm=' . $mrh_login . '&' ;
$url .= 'oa=' . $out_summ . '&' ;
$url .= 'currency=' . $currency . '&' ;
$url .= 'o=' . $shp_item . '&' ;
$url .= 's=' . $crc ;
header ( 'location: ' . $url );
die ();
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
?>
2023-08-10 14:04:23 +00:00
< HTML lang = " ru " >
2023-03-31 16:54:33 +00:00
< HEAD >
< title > Покупка ЕвроКредитов - Бойцовский Клуб </ title >
2023-03-31 18:30:14 +00:00
< script type = " text/javascript " src = " /res/js/jquery-1.7.1.min.js " ></ script >
2023-03-31 16:54:33 +00:00
< link href = " /res/css/style.css " rel = " stylesheet " type = " text/css " media = " all " />
< META Http - Equiv = Cache - Control Content = no - cache >
< meta http - equiv = PRAGMA content = NO - CACHE >
< META Http - Equiv = Expires Content = 0 >
< style >
. t , . t tr , . t tr td {
2023-08-10 14:04:23 +00:00
font - family : " Trebuchet MS " , serif ;
2023-03-31 16:54:33 +00:00
font - size : 16 px ;
border : 1 px solid black ;
border - collapse : collapse ;
text - align : center ;
vertical - align : top ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t {
border : 3 px solid black ;
border - collapse : collapse ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . al {
text - align : left ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . vam {
vertical - align : middle ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . ac {
text - align : center ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . b {
font - weight : bold ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . p {
2023-08-10 14:04:23 +00:00
padding : 0 5 px ;
2023-03-31 16:54:33 +00:00
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . btop {
border - top : 3 px solid black ;
border - collapse : collapse ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . bright {
border - right : 3 px solid black ;
border - collapse : collapse ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . bleft {
border - left : 3 px solid black ;
border - collapse : collapse ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . bbottom {
border - bottom : 3 px solid black ;
border - collapse : collapse ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
. t . light {
background : #D6F5D3;
color : green ;
font - weight : bold ;
}
</ style >
</ HEAD >
< body >
< div id = " main " >
< img alt = " freekassa " src = " image/free.png " width = " 300 " height = " 110 " >
< ? php if ( ! empty ( $u -> info [ 'id' ])) : ?>
< div style = " padding:10px; border-bottom:1px solid white; text-align: center; " >
2023-12-05 01:01:04 +00:00
Персонаж : < ? = User :: getLogin ( $u -> info [ 'id' ]) ?>
2023-03-31 16:54:33 +00:00
</ div >
< ? php endif ; ?>
< ? php if ( ! empty ( $u -> error )) : ?>
< div style = " padding:10px; color: red; font-weight: bold; " >
< ? = $u -> error ?>
</ div >
< ? php endif ; ?>
< ? php if ( $ball == 0 ) : ?>
< div style = 'font-weight:bold; color:red; padding: 10px 0 10px 0; font-size: 1.2em; text-align: center;' >
Акция ! При первом пополнении баланса , < br >
2023-08-10 14:04:23 +00:00
Вы получаете дополнительно 20 % екр к сумме покупки БЕСПЛАТНО .
2023-03-31 16:54:33 +00:00
</ div >
< ? php endif ; ?>
< table style = " width:98%; margin: auto; " >
< tr >
< td style = " width: 500px; padding: 10px; vertical-align: top; " >
< fieldset style = " border: 1px solid white; padding: 10px;margin-top:15px; font-weight: bold; " >
2023-08-10 14:04:23 +00:00
< legend ></ legend >
2023-03-31 16:54:33 +00:00
< span style = 'color:#8F0000;' > Ваш накопительный бонус :</ span >
2023-08-10 14:04:23 +00:00
< span style = " color: green; " >< ? = $bns [ $b1 ][ 1 ] ?> % (<?= $ball ?> екр)</span>
2023-03-31 16:54:33 +00:00
</ fieldset >
2023-08-10 14:04:23 +00:00
< fieldset style = " width:480px; border: 1px solid white; margin-top:15px; padding: 10px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Покупка екр </ legend >
2023-03-31 16:54:33 +00:00
2023-08-10 14:04:23 +00:00
< form method = " post " id = " ekrform " action = " /ekr.php?buy_ekr=1 " onsubmit = " if(document.getElementById('ekr').value<1) { alert('Нельзя купить менее 1 екр!'); return false;} " >
< label for = " ekr " style = " font-weight: bold; " > Сумма екр :</ label >
< input type = " number " name = " ekr " id = " ekr " min = " 1 " max = " 99999 " onchange = " calc(); " onkeyup = " calc(); " > & nbsp ;
2023-03-31 16:54:33 +00:00
< input type = " submit " class = " btn btn-success " value = " Пополнить баланс " >< br />
2023-08-10 14:04:23 +00:00
</ form >
< div id = " calc " style = " font-weight: bold; width: 400px; margin: 10px auto; " >
& nbsp ; < br >& nbsp ; < br >& nbsp ;
</ div >
2023-03-31 16:54:33 +00:00
2023-08-10 14:04:23 +00:00
< script >
function bonus_n ( a ) {
const pr = < ? = ( $bns [ $b1 ][ 1 ]) ?> ;
return ( Math . floor (( a * pr / 100 ) * 100 ) / 100 );
}
2022-08-25 17:08:08 +00:00
2023-08-10 14:04:23 +00:00
function bonus_s ( a ) {
if ( a >= 100 ) {
pr = 20 ;
} else if ( a >= 10 ) {
pr = 10 ;
} else {
pr = 0 ;
2022-08-25 17:08:08 +00:00
}
2023-08-10 14:04:23 +00:00
return ( Math . floor (( a * pr / 100 ) * 100 ) / 100 );
}
2022-08-25 17:08:08 +00:00
2023-08-10 14:04:23 +00:00
function calc () {
document . getElementById ( 'ekr' ) . value = document . getElementById ( 'ekr' ) . value . replace ( / [ ^ \d\ . ] +/ g , '' );
let ekr = document . getElementById ( 'ekr' ) . value ;
if ( ekr . match ( /^ [ - \ + ] ? [ \d ] + \ . ? [ \d ] * $ / ) == null ) {
ekr = 0 ;
2022-08-25 17:08:08 +00:00
}
2023-08-10 14:04:23 +00:00
if ( document . getElementById ( 'ekr' ) . value != ekr ) {
document . getElementById ( 'ekr' ) . value = ekr ;
2022-08-25 17:08:08 +00:00
}
2023-08-10 14:04:23 +00:00
//alert(ekr);
let ekr2 = bonus_n ( ekr ); //alert(ekr2);
let ekr3 = bonus_s ( ekr ); //alert(ekr3);
let ekr7 = 0 ;
ekr2 = Math . floor ( ekr2 * 100 ) / 100 ;
ekr3 = Math . floor ( ekr3 * 100 ) / 100 ;
< ? php if ( $ball == 0 ) : ?>
ekr7 = Math . floor (( ekr / 5 ) * 100 ) / 100 ;
< ? php endif ; ?>
let ekrr = ekr + ekr2 + ekr3 + ekr7 ;
ekrr = Math . round ( ekrr * 100 ) / 100 ;
document . getElementById ( 'calc' ) . innerHTML = 'Накопительный бонус: <font color=green>' + ekr2 + ' екр</font><br />Оптовый бонус: <font color=green>' + ekr3 + ' екр</font><?php if($ball == 0) { ?><br />Акция на 1-о е пополнение: <font color=red>' + ekr7 + ' екр</font><?php } ?><br />Итого: <font color=green>' + ekrr + ' екр</font>' ;
}
2022-08-25 17:08:08 +00:00
2023-08-10 14:04:23 +00:00
calc ();
</ script >
2023-03-31 16:54:33 +00:00
2023-08-10 14:04:23 +00:00
< table style = " border: 1px solid white; margin: auto; width: 400px; " >
< tr style = " border-bottom: 1px solid white; " >
< td style = " border-right: 1px solid white;padding:2px; " > 1 екр </ td >
< td style = " padding:2px; " > ₽ < ? = $exchangeToday -> oneEkrInRUB () ?> </td>
</ tr >
< tr style = " border-bottom: 1px solid white; " >
< td style = " border-right: 1px solid white;padding:2px; " > 1 екр </ td >
< td style = " padding:2px; " > $ < ? = $exchangeToday -> oneEkrInUSD () ?>
< sub style = " font-size: xx-small; color: grey; " > [ курс ЦБ РФ ] </ sub >
</ td >
</ tr >
</ table >
< div style = " font-size: smaller; border-left: 4px dashed crimson; padding: 0 5px; background-color: silver; margin: 10px 0; " >
< strong > Зачисление средств производится в автоматическом режиме , сразу же после оплаты .</ strong >< br >
В случае проблем с оплатой игровых бонусов обращайтесь в
< a href = " https://www.free-kassa.ru/support.php " target = " _blank " > службу поддержки FREE - KASSA </ a >.
</ div >
< div style = " font-size: smaller; " >
Внимание ! При пополнении баланса вы соглашаетесь с :
< div style = " font-size: xx-small; margin: 10px 0; " >
⁕ < a href = " /encicl/law2.html " target = " _blank " > Cо г ла ше ние м о предоставлении сервиса </ a >< br >
⁕ < a href = " /encicl/law3.html " target = " _blank " > Политикой Конфиеденцальности </ a >< br >
⁕ < a href = " /encicl/law4.html " target = " _blank " > Договором публичной оферты </ a >< br >
</ div >
По вопросам использования других способов оплаты обратитесь к игровым
< img src = " <?= Config::img() ?>/i/align/align50.gif " alt = " Администратор " >& nbsp ; < strong > Администраторам </ strong >.
</ div >
2023-03-31 16:54:33 +00:00
</ fieldset >
</ td >
< td style = " padding: 10px; vertical-align: top; " >
2023-08-10 14:04:23 +00:00
< div style = " border: 1px solid white; padding: 10px;margin-top:15px; color:#8F0000; font-weight: bold; " >
Ваш баланс : < span style = " color: green " >< ? = $u -> info [ 'money2' ] ?> екр</span> и <?= $u->info['money'] ?> кр.
2023-03-31 16:54:33 +00:00
</ div >
< fieldset style = " border: 1px solid white; padding: 10px;margin-top:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Обмен </ legend >
2023-08-10 14:04:23 +00:00
< form method = " post "
onsubmit = " if(document.getElementById('ekr2').value><?= $day1 ?>) { alert('Сегодня вы можете еще обменять не более <?= $day1 ?> екр');return false;} else if(document.getElementById('ekr2').value<0.01||document.getElementById('ekr2').value><?= $day1 ?>) { alert('З а 1 раз Вы можете обменять сумму от 0.01 до <?= $day1 ?> екр.');return false;} else { return confirm('Вы действительно хотите обменять '+document.getElementById('ekr2').value+' екр на '+(document.getElementById('ekr2').value*<?= Config::EKR_TO_KR_EXCHANGE ?>)+' кр ? В обратном направлении обмен с кр на екр будет невозможен.');} " >
< label for = " ekr2 " > Обменять екр на кр по курсу < b > 1 екр = < ? = Config :: EKR_TO_KR_EXCHANGE ?> кр</b>:</label>
< input type = " number " name = " ekr2 " id = " ekr2 " min = " 1 " max = " <?= $day1 ?> " placeholder = " <?= $day1 ?> max " onchange = " calc22() " onkeyup = " calc22() " >
& nbsp ; < input type = " submit " class = " btn btn-success " name = " submit " id = " calc2 " value = " Обменять " >< br />
2023-03-31 16:54:33 +00:00
</ form >
2023-08-10 14:04:23 +00:00
< form method = " post "
2023-03-31 16:54:33 +00:00
onsubmit = " if(document.getElementById('kr001').value<<?= round(
2023-08-10 14:04:23 +00:00
Config :: KR_TO_EKR_EXCHANGE / 100 , 2
2023-03-31 16:54:33 +00:00
) ?> ) {alert('Минимальная сумма обмена <?= round(
2023-08-10 14:04:23 +00:00
Config :: KR_TO_EKR_EXCHANGE / 100 , 2
) ?> кр');return false;}else if(document.getElementById('kr001').value><?= $day2 ?>) {alert('Сегодня вы можете еще обменять не более <?= $day2 ?> кр');return false;} else {return confirm('Вы действительно хотите обменять '+document.getElementById('kr001').value+' кр на '+(Math.round(document.getElementById('kr001').value/10)/50)+' екр? Отменить операцию обмена будет невозможно.');}">
< label for = " kr001 " > Обменять кр на екр по курсу < b >< ? = Config :: KR_TO_EKR_EXCHANGE ?> кр = 1 екр</b>:</label>
< input type = " text " style = " margin-left:1px; " name = " kr001 " id = " kr001 " value = " " placeholder = " <?= $day2 ?> max " size = " 5 " onchange = " calc24(); " onkeyup = " calc23(); " >
< input type = " submit " class = " btn btn-success " name = " submit " id = " calc3 " value = " Обменять " >< br >
2023-03-31 16:54:33 +00:00
</ form >
< script >
2023-08-10 14:04:23 +00:00
// Калькулятор kr->ekr.
2023-03-31 16:54:33 +00:00
function calc23 () {
2023-08-10 14:04:23 +00:00
document . getElementById ( 'kr001' ) . value = document . getElementById ( 'kr001' ) . value . replace ( / [ ^ \d . ] +/ g , '' );
let kr001 = document . getElementById ( 'kr001' ) . value ;
2023-03-31 16:54:33 +00:00
kr001 = Math . floor ( kr001 / 10 ) * 10 ;
2023-08-10 14:04:23 +00:00
const kr001ekr = kr001 / < ? = Config :: KR_TO_EKR_EXCHANGE ?> ;
if ( kr001 === 0 ) {
document . getElementById ( " calc3 " ) . className = document . getElementById ( " calc3 " ) . className . replace ( / ( ? :^| \s ) btn - success ( ? ! \S ) / g , '' );
document . getElementById ( " calc3 " ) . className += " btn-danger " ;
document . getElementById ( 'calc3' ) . disabled = true ;
document . getElementById ( 'calc3' ) . value = 'Введите количество' ;
} else {
document . getElementById ( " calc3 " ) . className = document . getElementById ( " calc3 " ) . className . replace ( / ( ? :^| \s ) btn - danger ( ? ! \S ) / g , '' );
document . getElementById ( " calc3 " ) . className += " btn-success " ;
document . getElementById ( 'calc3' ) . disabled = false ;
document . getElementById ( 'calc3' ) . value = 'Обменять ' + kr001 + ' кр на ' + kr001ekr + ' екр' ;
}
2023-03-31 16:54:33 +00:00
return kr001 ;
}
2022-12-30 19:03:37 +00:00
2023-03-31 16:54:33 +00:00
function calc24 () {
document . getElementById ( 'kr001' ) . value = calc23 ();
if ( document . getElementById ( 'kr001' ) . value == 0 ) document . getElementById ( 'kr001' ) . value = '' ;
}
2022-08-25 17:08:08 +00:00
2023-03-31 16:54:33 +00:00
calc24 ();
2022-08-25 17:08:08 +00:00
2023-08-10 14:04:23 +00:00
// Калькулятор ekr->kr.
2023-03-31 16:54:33 +00:00
function calc22 () {
2023-08-10 14:04:23 +00:00
document . getElementById ( 'ekr2' ) . value = document . getElementById ( 'ekr2' ) . value . replace ( / [ ^ \d . ] +/ g , '' );
let ekre = document . getElementById ( 'ekr2' ) . value ;
2023-04-08 15:14:19 +00:00
if ( ekre . match ( /^ [ - \ + ] ? [ \d ] + \ . ? [ \d ] * $ / ) == null ) {
2023-03-31 16:54:33 +00:00
ekre = 0 ;
}
2022-08-25 11:23:36 +00:00
2023-03-31 16:54:33 +00:00
ekre = Math . floor ( ekre * 100 ) / 100 ;
2023-08-10 14:04:23 +00:00
const ekr4 = ekre . toFixed ( 2 );
2022-08-25 11:23:36 +00:00
2023-03-31 16:54:33 +00:00
if ( document . getElementById ( 'ekr2' ) . value != ekre ) {
document . getElementById ( 'ekr2' ) . value = ekr4 ;
}
2023-08-10 14:04:23 +00:00
var kre = parseFloat ( ekre ) * < ? = Config :: EKR_TO_KR_EXCHANGE ?> ;
if ( ekre === 0 ) {
document . getElementById ( " calc2 " ) . className = document . getElementById ( " calc3 " ) . className . replace ( / ( ? :^| \s ) btn - success ( ? ! \S ) / g , '' );
document . getElementById ( " calc2 " ) . className += " btn-danger " ;
document . getElementById ( 'calc2' ) . disabled = true ;
document . getElementById ( 'calc2' ) . value = 'Введите количество' ;
} else {
document . getElementById ( " calc2 " ) . className = document . getElementById ( " calc3 " ) . className . replace ( / ( ? :^| \s ) btn - danger ( ? ! \S ) / g , '' );
document . getElementById ( " calc2 " ) . className += " btn-success " ;
document . getElementById ( 'calc2' ) . disabled = false ;
document . getElementById ( 'calc2' ) . value = 'Обменять ' + ekre + ' екр на ' + kre . toFixed ( 0 ) + ' кр' ;
}
2023-03-31 16:54:33 +00:00
}
2022-08-25 11:23:36 +00:00
2023-03-31 16:54:33 +00:00
calc22 ();
</ script >
</ fieldset >
< fieldset style = " border: 1px solid white; padding: 20px 11px 21px 11px;margin-top:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Накопительные бонусы </ legend >
< table class = " t " style = " width: 500px; margin: auto; " >
2023-08-10 14:04:23 +00:00
< caption ></ caption >
2023-03-31 16:54:33 +00:00
< tr class = " b " >
2023-08-10 14:04:23 +00:00
< th > екр </ th >
< th class = " bright " > Бонус </ th >
< th > екр </ th >
< th > Бонус </ th >
2023-03-31 16:54:33 +00:00
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 800 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 10 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 3 000 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 30 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 700 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 9 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 2 500 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 27 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 600 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 8 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 2 000 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 25 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 500 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 7 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 700 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 23 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 400 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 6 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 500 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 21 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 300 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 5 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 300 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 19 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 200 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 4 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 200 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 17 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 100 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 3 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 100 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 15 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 50 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 2 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 1 000 екр < img src = " /res/img/medals/vip.gif " title = " VIP " style = " margin-top:2px; width: 20px; " alt = " VIP " ></ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 13 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td class = " " > 10 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " bright " > 1 %</ td >
2023-08-10 14:04:23 +00:00
< td class = " " > 900 екр </ td >
2023-03-31 16:54:33 +00:00
< td class = " " > 11 %</ td >
</ tr >
</ table >
</ fieldset >
< fieldset style = " border: 1px solid white; padding: 18px 12px 18px 12px;margin-top:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Оптовые бонусы </ legend >
< table class = " t " style = " width: 500px; margin: auto; " >
2023-08-10 14:04:23 +00:00
< caption ></ caption >
2023-03-31 16:54:33 +00:00
< tr class = " b light " >
2023-08-10 14:04:23 +00:00
< th scope = " row " > Бонус </ th >
2023-03-31 16:54:33 +00:00
< td > 10 %</ td >
< td > 10 %</ td >
< td > 10 %</ td >
< td > 10 %</ td >
< td > 10 %</ td >
</ tr >
< tr style = " border-bottom: 2px solid black; " >
2023-08-10 14:04:23 +00:00
< th scope = " row " class = " b " > Сумма </ th >
< td > 10 екр </ td >
< td > 20 екр </ td >
< td > 30 екр </ td >
< td > 40 екр </ td >
< td > 50 екр </ td >
2023-03-31 16:54:33 +00:00
</ tr >
< tr class = " b light " >
2023-08-10 14:04:23 +00:00
< th scope = " row " class = " b " > Бонус </ th >
2023-03-31 16:54:33 +00:00
< td > 10 %</ td >
< td > 10 %</ td >
< td > 10 %</ td >
< td > 10 %</ td >
< td > 20 %</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< th scope = " row " class = " b " > Сумма </ th >
< td > 60 екр </ td >
< td > 70 екр </ td >
< td > 80 екр </ td >
< td > 90 екр </ td >
< td > 100 екр </ td >
2023-03-31 16:54:33 +00:00
</ tr >
</ table >
</ fieldset >
</ td >
</ tr >
< tr >
2023-08-10 14:04:23 +00:00
< td colspan = " 2 " style = 'font-weight:bold; color:#8F0000; padding: 10px 0 10px 0; font-size: 1.5em; text-align: center;' >
Коммерческие услуги
2023-03-31 16:54:33 +00:00
</ td >
</ tr >
< tr >
< td colspan = " 2 " style = " padding: 10px; vertical-align: top; " >
<!-- komplekt form -->
< div class = " komplekt-form " id = " theLayer "
style = " position: absolute; left: -300px; top: 160px; visibility:hidden; width: 150px; height:320px; " >
< div class = " form-title " id = " titleBar " >
< label id = " ftitle " > Просмотр </ label >
< button type = " button " class = " close "
onclick = " document.getElementById('theLayer').style.visibility = 'hidden';return false "
data - dismiss = " modal " aria - hidden = " true " > x
</ button >
</ div >
< div class = " form " >
< form method = " post " id = " fform " action = " ekr.php " >
< input type = " hidden " name = " do " value = " newShadow " />
< input type = " hidden " id = " ffinput " name = " ffinput " value = " " />
< center >
< img src = " " id = " ffimg " width = " 120 " height = " 220 " style = " margin-bottom: 5px; " />< br >
< div style = " padding:5px; " >
< select name = " ffsex " id = " ffsex " >
< option value = " 0 " < ? php if ( $u -> info [ 'sex' ] == 0 ) {
echo 'selected="selected"' ;
} ?> >Мужской образ
</ option >
< option value = " 1 " < ? php if ( $u -> info [ 'sex' ] == 1 ) {
echo 'selected="selected"' ;
} ?> >Женский образ
</ option >
</ select >
</ div >
2023-04-15 19:18:30 +00:00
< div
2023-07-11 15:16:35 +00:00
style = " width:240px; margin-left:-6px;background:#cbc4aa;padding:5px 0px 5px 0px;border:1px solid #cbc4aa;background-color:#eee;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:none;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box; " >
2023-03-31 16:54:33 +00:00
< input type = " button " class = " btn btn-success " value = " Подтвердить "
style = " height: 28px; line-height: 20px; width: 100px;font-size:13px; "
onclick = " if(confirm('Действительно хотите купить это изображение?')) $ ('#fform').submit(); " />
< input type = " button " class = " btn btn-danger " value = " Отменить "
onclick = " document.getElementById('theLayer').style.visibility = 'hidden';return false "
style = " height: 28px; line-height: 20px; width: 100px;font-size:13px; " />
</ div >
</ center >
</ form >
</ div >
</ div >
< table style = " width: 100% " >
< tr >
< td style = " vertical-align: baseline; " >
< fieldset style = " width:480px; border: 1px solid white; padding: 10px;margin:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Покупка личного образа </ legend >
< small >
2023-08-10 14:04:23 +00:00
< b > Стоимость услуги : 100 екр </ b >< br >
2023-03-31 16:54:33 +00:00
Требования к персональному образу :< br />
GIF - картинка размером 120 x220 ( ШхВ ) и весом до 300 К б .< br />
< br >
Выберите картинку : < input type = " file " id = " imgFile " />
< script >
function showImgPreview ( img ) {
document . getElementById ( 'theLayer' ) . style . visibility = " visible " ;
document . getElementById ( 'theLayer' ) . style . left = 300 ;
document . getElementById ( 'theLayer' ) . style . top = 300 ;
2023-03-31 18:30:14 +00:00
$ ( 'img#ffimg' ) . attr ( 'src' , '/clan_prw/' + img );
2023-03-31 16:54:33 +00:00
document . getElementById ( 'ffinput' ) . value = img ;
$ ( 'img#ffimg' ) . attr ( 'height' , '220' );
document . getElementById ( 'theLayer' ) . style . height = 290 ;
}
function showImgPreviewPet ( img ) {
document . getElementById ( 'theLayer' ) . style . visibility = " visible " ;
document . getElementById ( 'theLayer' ) . style . left = 300 ;
document . getElementById ( 'theLayer' ) . style . top = 300 ;
2023-03-31 18:30:14 +00:00
$ ( 'img#ffimg' ) . attr ( 'src' , '/clan_prw/' + img );
2023-03-31 16:54:33 +00:00
$ ( 'img#ffimg' ) . attr ( 'height' , '40' );
//$('#theLayer').attr('height','120');
document . getElementById ( 'ffinput' ) . value = img ;
document . getElementById ( 'ffsex' ) . style . display = 'none' ;
document . getElementById ( 'theLayer' ) . style . height = 105 ;
$ ( 'html, body' ) . animate ({ scrollTop : 0 }, 'slow' );
}
function showImgPreviewSmile ( img ) {
document . getElementById ( 'theLayer' ) . style . visibility = " visible " ;
document . getElementById ( 'theLayer' ) . style . left = 300 ;
document . getElementById ( 'theLayer' ) . style . top = 300 ;
2023-03-31 18:30:14 +00:00
$ ( 'img#ffimg' ) . attr ( 'src' , '/clan_prw/' + img );
2023-03-31 16:54:33 +00:00
$ ( 'img#ffimg' ) . attr ( 'width' , null );
$ ( 'img#ffimg' ) . attr ( 'height' , null );
document . getElementById ( 'ffinput' ) . value = img ;
document . getElementById ( 'ffsex' ) . style . display = 'none' ;
document . getElementById ( 'theLayer' ) . style . height = 105 ;
$ ( 'html, body' ) . animate ({ scrollTop : 0 }, 'slow' );
}
$ ( '#imgFile' ) . change ( function () {
var fd = new FormData ();
fd . append ( 'type' , 'person' );
fd . append ( 'img' , $ ( '#imgFile' )[ 0 ] . files [ 0 ]);
$ . ajax ({
type : 'POST' ,
url : 'ekr.php' ,
data : fd ,
processData : false ,
contentType : false ,
dataType : " json " , // поменять на json
success : function ( data ) {
if ( data [ 'img' ] != undefined ) {
document . getElementById ( 'ffsex' ) . style . display = 'none' ;
showImgPreview ( data [ 'img' ])
} else {
alert ( data [ 'err' ]);
}
},
error : function ( data ) {
alert ( 'Ошибка AJAX.' )
}
});
})
</ script >
</ small >
</ fieldset >
</ td >
< td style = " vertical-align: baseline; " >
< fieldset style = " border: 1px solid white; padding: 10px;margin:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Покупка личного смайлика </ legend >
< small >
< b > Стоимость услуги : < ? php $ekr_smile = 10 ;
2023-08-10 14:04:23 +00:00
echo $ekr_smile ; ?> екр</b><br>
2023-03-31 16:54:33 +00:00
Требования к смайлику :< br />
GIF - картинка размером от 15 x15 до 95 x21 ( ШхВ ) и весом до 30 К б .< br />
< br >
Выберите картинку : < input type = " file " id = " imgFile5 " />
< script >
$ ( '#imgFile5' ) . change ( function () {
var fd = new FormData ();
fd . append ( 'type' , 'person' );
fd . append ( 'img5' , $ ( '#imgFile5' )[ 0 ] . files [ 0 ]);
$ . ajax ({
type : 'POST' ,
url : 'ekr.php' ,
data : fd ,
processData : false ,
contentType : false ,
dataType : " json " , // поменять на json
success : function ( data ) {
if ( data [ 'img' ] != undefined ) {
showImgPreviewSmile ( data [ 'img' ])
} else {
alert ( data [ 'err' ]);
}
},
error : function ( data ) {
alert ( 'Ошибка AJAX.' );
}
});
})
</ script >
</ small >
</ fieldset >
</ td >
< td style = " vertical-align: baseline; " >
< fieldset style = " border: 1px solid white; padding: 10px;margin:15px; " >
< legend style = 'font-weight:bold; color:#8F0000;' > Смена имени персонажа </ legend >
< small >
2023-08-10 14:04:23 +00:00
< b > Стоимость услуги : 25 екр </ b >< br >
2023-03-31 16:54:33 +00:00
Текущее имя : < ? = $u -> info [ 'login' ] ?> <br>
< form method = " post " action = " ekr.php " id = " lform " >
< input type = " hidden " name = " do " value = " changeLogin " />
< input type = " text " name = " login " id = " llogin " onkeyup = " check_login(); " size = 35
placeholder = " Введите новое имя.. " style = " margin: 5px 0 5px 0; " />
< span
2023-07-11 15:16:35 +00:00
id = " ajaxLogin " ></ span >< br >
2023-03-31 16:54:33 +00:00
< input type = " button " class = " btn btn-success " value = " Сменить имя "
onclick = " if(confirm('Действительно хотите сменить имя?')) $ ('#lform').submit(); " />
</ form >
< script >
function check_login () {
$ ( " #ajaxLogin " ) . html ( '<b>Проверка доступности...</b>' );
$ . ajax ({
url : " ajax_checklogin.php?login= " + $ ( '#llogin' ) . val (),
cache : false
}) . done ( function ( html ) {
$ ( " #ajaxLogin " ) . html ( html );
});
}
</ script >
</ small >
</ fieldset >
</ td >
</ tr >
</ table >
<!-- end komplekt form -->
</ td >
</ tr >
< tr >
< td colspan = " 2 " >& nbsp ; </ td >
</ tr >
</ table >
</ div >
</ BODY >
</ HTML >