game/cron/comission.php.bac

70 lines
2.8 KiB
Plaintext
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
define('GAME',true);
setlocale(LC_CTYPE ,"ru_RU.CP1251");
include('/home/newcom1/public_html/_incl_data/__config.php');
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
include('/home/newcom1/public_html/_incl_data/class/__user.php');
/*
CRON <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
1. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 2 <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 50% <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>.
*/
$time_last = 86400 * 6; //2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sp = mysql_query('SELECT * FROM `items_com` WHERE `delete` = 0 AND `time` < "'.(time()-$time_last).'"');
while( $pl = mysql_fetch_array($sp) ) {
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1'));
//
$itm_user = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "'.$pl['item_id'].'" LIMIT 1'));
$itm_main = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$pl['items_id'].'" LIMIT 1'));
//
$shpCena = $itm_user['1price'];
$plmx = 0;
if($itm_main['iznosMAXi']!=$itm_user['iznosMAX'] && $itm_user['iznosMAX']!=0){
$plmx = $itm_main['iznosMAX'];
}else{
$plmx = $itm_main['iznosMAXi'];
}
if($itm_user['iznosNOW']>0){
$prc1 = $itm_user['iznosNOW']/$plmx*100;
}else{
$prc1 = 0;
}
$shpCena = $u->shopSaleM( $shpCena , $itm_user );
$shpCena = $shpCena/100*(100-$prc1);
if( $itm_user['iznosMAXi'] < 999999999 ) {
if($itm_user['iznosMAX']>0 && $itm_main['iznosMAXi']>0 && $itm_main['iznosMAXi']>$itm_user['iznosMAX']){
$shpCena = $shpCena/100*($itm_user['iznosMAX']/$itm_main['iznosMAXi']*100);
}
}
$shpCena = $shpCena/2 * $pl['group'];
$shpCena = $u->round2($shpCena/100*(100-$shopProcent));
if($shpCena<0){
$shpCena = 0;
}
//
$itm_user['1price'] = $shpCena;
//
if( $itm_user['1price'] < 0.01 ) {
$itm_user['1price'] = 0.01;
}
//
mysql_query('UPDATE `items_com` SET `delete` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
mysql_query('INSERT INTO `items_users` (`delete`,`item_id`,`1price`,`uid`,`lastUPD`) VALUES ("0","1220","'.$itm_user['1price'].'","-51'.$user['id'].'","'.time().'")');
mysql_query('INSERT INTO `post` (`uid`,`sender_id`,`time`,`money`,`text`) VALUES (
"'.$user['id'].'","0","'.time().'","'.$itm_user['1price'].'","<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> &quot;'.$itm_main['name'].''.$grp.'&quot; (<28><><EFBFBD><EFBFBD><EFBFBD>: '.ceil($itm_user['iznosNOW']).'/'.ceil($itm_user['iznosMAX']).') <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <b>'.$itm_user['1price'].' <20><></b>."
)');
//
$grp = '';
if( $pl['group'] > 1 ) {
$grp = ' (x'.$pl['group'].')';
}
$u->send('','','','<font color=#009966 ><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></font>',$user['login'],'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> &quot;'.$itm_main['name'].''.$grp.'&quot; (<28><><EFBFBD><EFBFBD><EFBFBD>: '.ceil($itm_user['iznosNOW']).'/'.ceil($itm_user['iznosMAX']).') <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <b>'.$itm_user['1price'].' <20><>.</b>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>.',time(),6,0,0,0,1,0);
}
?>