room['file'] == 'bsenter') { $r = 2; if (isset($_GET['r'])) { $_GET['r'] = (int)$_GET['r']; if ($_GET['r'] == 7 || $_GET['r'] == 8 || $_GET['r'] == 9 || $_GET['r'] == 10 || $_GET['r'] == 11) { $r = round($_GET['r'] - 6); } if ($u->info['level'] < $r + 6) { $r = 1; } } function changeSleep($uid, $sleep_action) { global $u; if ($sleep_action == 1) { // mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time() . '","1")'); // mysql_query( "UPDATE `eff_users` SET `sleeptime`=" . time() . ",`deactiveLast` = ( `deactiveTime` - " . time() . " ) WHERE `uid`='" . mysql_real_escape_string( $uid ) . "' AND `no_Ace` = 0 AND `delete` = 0" ); mysql_query('UPDATE `items_users` SET `time_sleep` = "' . time() . '" WHERE `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); $u->addAction(time(), 'sleep', $u->info['city']); // } elseif ($sleep_action == 2) { // mysql_query('INSERT INTO `sleep` (`uid`,`time`,`sleep`) VALUES ("' . $uid . '","' . time() . '","2")'); // $sp = mysql_query('SELECT * FROM `items_users` WHERE `time_sleep` > 0 AND `uid` = "' . $uid . '" AND `delete` < 1001 AND `data` LIKE "%|sleep_moroz=1%"'); while ($pl = mysql_fetch_array($sp)) { $tm_add = time() - $pl['time_sleep']; mysql_query('UPDATE `items_users` SET `time_sleep` = "0",`time_create` = "' . ($pl['time_create'] + $tm_add) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); } $sp = mysql_query( 'SELECT `id`,`deactiveTime`,`deactiveLast` FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > 0 AND `uid` = "' . $uid . '" ORDER BY `timeUse` DESC' ); while ($pl = mysql_fetch_array($sp)) { mysql_query("UPDATE `eff_users` SET `deactiveTime` = " . (time() + $pl['deactiveLast']) . " WHERE `id`='" . $pl['id'] . "' "); } $sp = mysql_query('SELECT `id`,`sleeptime`,`timeUse` FROM `eff_users` WHERE `uid`="' . mysql_real_escape_string($uid) . '" AND `no_Ace` = 0 AND `sleeptime` > 0 AND `delete` = 0'); while ($pl = mysql_fetch_array($sp)) { $timeUsen = time() - ($pl['sleeptime'] - $pl['timeUse']); mysql_query("UPDATE `eff_users` SET `timeUse`='" . $timeUsen . "',`sleeptime`='0' WHERE `id`='" . $pl['id'] . "' "); } mysql_query('UPDATE `actions` SET `vars` = "unsleep",`val` = "' . time() . '" WHERE `id` = "' . $sleep['id'] . '" LIMIT 1'); } } $t = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "' . $u->info['city'] . '" AND `level` = "' . ((int)($r + 6)) . '" LIMIT 1')); if (isset($t['id'])) { if ($t['time_start'] > time()) { $tz = mysql_fetch_array( mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "' . $t['id'] . '" AND `time` = "' . $t['time_start'] . '" AND `uid` = "' . $u->info['id'] . '" AND `finish` = 0 LIMIT 1') ); $tz_all = mysql_fetch_array( mysql_query( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t['id'] . '" AND `time` = "' . $t['time_start'] . '" AND `uid` = "' . $u->info['id'] . '" AND `finish` <= "' . $t['time_start'] . '" LIMIT 1' ) ); } if (isset($_POST['coin']) && $t['time_start'] > time()) { $_POST['coin'] = round((int)$_POST['coin'], 2); if ((round((int)$tz['money'], 2) + $_POST['coin']) > 3 * $u->info['level'] || $tz_all[0] > 3 * $u->info['level']) { $error = 'Вам нельзя делать ставку выше ' . (3 * $u->info['level']) . ' кр.'; } elseif (($_POST['coin'] >= $t['min_money'] || (isset($tz['id']) && $_POST['coin'] >= 1)) && $u->info['money'] >= $_POST['coin']) { $t['money'] += $_POST['coin']; $u->info['money'] -= $_POST['coin']; if (isset($tz['id'])) { $tz['money'] += $_POST['coin']; mysql_query('UPDATE `bs_zv` SET `money` = "' . $tz['money'] . '" WHERE `id` = "' . $tz['id'] . '" LIMIT 1'); } else { //создаем $tz_all = mysql_fetch_array( mysql_query( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t['id'] . '" AND `time` = "' . $t['time_start'] . '" AND `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' ) ); $ins = mysql_query( 'INSERT INTO `bs_zv` (`bsid`,`money`,`time`,`uid`) VALUES ("' . $t['id'] . '","' . mysql_real_escape_string( $_POST['coin'] ) . '","' . $t['time_start'] . '","' . $u->info['id'] . '")' ); if ($ins) { $tz_all = mysql_fetch_array( mysql_query( 'SELECT SUM(`money`) FROM `bs_zv` WHERE `bsid` = "' . $t['id'] . '" AND `time` = "' . $t['time_start'] . '" AND `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1' ) ); if ($tz_all[0] > 0) { $_POST['coin'] = $tz_all[0]; $error = 'Ваша ставка была возвращена. (' . round($_POST['coin'], 2) . ' кр.)'; } $t['users']++; $tz = ['id' => 1, 'bsid' => $t['id'], 'money' => $_POST['coin'], 'time' => $t['time_start'], 'finish' => 0]; } } mysql_query('UPDATE `bs_turnirs` SET `money` = "' . $t['money'] . '", `users` = "' . $t['users'] . '" WHERE `id` = "' . $t['id'] . '" LIMIT 1'); mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); } } } if ($u->info['id'] != 7) { ?> ' . $re . ''; } ?>
= $u->room['name']; ?> |
|